Add high performance features, see #12

This commit is contained in:
Aaron Mueller 2012-07-06 17:09:07 +02:00
parent 76679d9a99
commit 7b40c7adb1
3 changed files with 20 additions and 19 deletions

View file

@ -5,25 +5,24 @@ ig.module(
'game.entities.paddle'
)
.defines(function(){
EntityPaddlePlayer = EntityPaddle.extend({
EntityPaddlePlayer = EntityPaddle.extend({
animSheet: new ig.AnimationSheet( 'media/paddle-player.png', 30, 96 ),
update: function(){
if( ig.input.state('up') ) {
if (ig.input.state('up')) {
this.vel.y = -400;
}
else if( ig.input.state('down') ) {
} else if (ig.input.state('down')) {
this.vel.y = 400;
}
else {
} else if (ig.input.state('force-top')) {
this.pos.y = 48;
} else if (ig.input.state('force-bottom')) {
this.pos.y = 240;
} else {
this.vel.y = 0;
}
this.parent();
}
});
});
});

View file

@ -9,7 +9,7 @@ ig.module(
EntityPaddle = ig.Entity.extend({
name: 'paddle',
scores: 0,
scores: 0, // TODO: whats this?
size: {x: 30, y: 96},
collides: ig.Entity.COLLIDES.FIXED,

View file

@ -23,6 +23,8 @@ ig.module(
ig.input.bind(ig.KEY.ESC, 'mainmenu');
ig.input.bind(ig.KEY.UP_ARROW, 'up');
ig.input.bind(ig.KEY.DOWN_ARROW, 'down');
ig.input.bind(ig.KEY.T, 'force-top');
ig.input.bind(ig.KEY.B, 'force-bottom');
// vim goodness
ig.input.bind(ig.KEY.K, 'up');
ig.input.bind(ig.KEY.J, 'down');