uberpong/dev/lib/game/entities/goal.js
Aaron Mueller 60b6af8e63 Add some score mechanism
If the AI or the human player looses 10 games, the game is over
and goes back into the main screen. A score is displayed on top
of the game for each side.
2012-06-24 23:03:05 +02:00

26 lines
422 B
JavaScript

ig.module(
'game.entities.goal'
)
.requires(
'impact.entity'
)
.defines(function(){
EntityGoal = ig.Entity.extend({
height: 90,
size: {x:48, y:48},
checkAgainst: ig.Entity.TYPE.B,
_wmScalable: true,
_wmDrawBox: true,
_wmBoxColor: '#00ff00',
check: function(other) {
if (other.name == 'ball') {
ig.game.score[this.owner] -= 1;
other.reset();
}
}
});
});