diff --git a/src/Asteroid.js b/src/Asteroid.js new file mode 100644 index 0000000..c3f89c4 --- /dev/null +++ b/src/Asteroid.js @@ -0,0 +1,26 @@ +/** @jsx React.DOM */ + +var React = require('react'); +var ReactKinetic = require('react-kinetic'); +var Circle = ReactKinetic.Circle; + +var Asteroid = React.createClass({ + getDefaultProps: function () { + return { + radius: 20, + velocity: [5, 5] + }; + }, + + render: function () { + return ( + + ); + } +}); + +module.exports = Asteroid; diff --git a/src/Asteroids.js b/src/Asteroids.js index de969a0..7b74666 100644 --- a/src/Asteroids.js +++ b/src/Asteroids.js @@ -9,6 +9,7 @@ var InputHandler = require('./InputHandler'); var ResourceLoader = require('./ResourceLoader'); var Ship = require('./Ship'); +var Asteroid = require('./Asteroid'); var Stage = ReactKinetic.Stage; var Layer = ReactKinetic.Layer; @@ -32,7 +33,10 @@ var Game = React.createClass({ playerRot: 0, playerRotVel: 0, playerRotAcc: 0, - currentTick: 0 + currentTick: 0, + asteroids: [{ + pos: [50, 50] + }] }; }, @@ -133,6 +137,13 @@ var Game = React.createClass({ render: function () { var planeSprite = this.props.resourceLoader.getResource('planeSprite'); + var asteroids = this.state.asteroids.map(function (asteroid, i) { + return ( + + ); + }); return ( + {asteroids} ); }