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