uberpong/dev/lib/game/entities/paddle-player.js
2013-04-18 21:52:22 +02:00

34 lines
740 B
JavaScript

ig.module(
'game.entities.paddle-player'
)
.requires(
'game.entities.paddle'
)
.defines(function(){
EntityPaddlePlayer = EntityPaddle.extend({
animSheet: new ig.AnimationSheet('media/paddle-player_sheet.png', 30, 120),
/*anim: null,
init: function(){
this.anim = new ig.Animation( this.animSheet, 0.1, [0,1,2,3,4] );
},*/
update: function(){
if (ig.input.state('up')) {
this.vel.y = -400;
} else if (ig.input.state('down')) {
this.vel.y = 400;
} 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();
}
});
});