uberpong/dev/lib/game/entities/paddle-player.js

30 lines
639 B
JavaScript
Raw Normal View History

ig.module(
'game.entities.paddle-player'
)
.requires(
'game.entities.paddle'
)
.defines(function(){
2012-07-06 17:09:07 +02:00
EntityPaddlePlayer = EntityPaddle.extend({
name: 'paddle-player',
animSheet: new ig.AnimationSheet('media/paddle-player.png', 30, 120),
2012-07-06 17:09:07 +02:00
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;
}
2012-07-06 17:09:07 +02:00
this.parent();
}
});
2012-06-24 10:50:26 +02:00
});