uberpong/dev/lib/game/entities/goal.js
Aaron Mueller b4c3d98984 Refactorthe score and make it global ...
Still full of bugs and crap ...
2013-04-18 21:55:26 +02:00

30 lines
618 B
JavaScript

ig.module(
'game.entities.goal'
)
.requires(
'impact.entity'
)
.defines(function(){
EntityGoal = ig.Entity.extend({
looseSound: new ig.Sound('media/sounds/loose.ogg'),
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') {
console.log(this.owner);
if (this.owner == 'player') ig.global.lifes -= 1;
if (this.owner == 'ai') ig.global.score += 2000;
other.reset();
this.looseSound.play();
}
}
});
});