Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- checkBounds: function(){
- var x = this.x + this.dx;
- var y = this.y + this.dy;
- var g_o = new Audio();
- g_o.src = "augame/game_over.mp3"
- if ( x < 0 ){
- this.x = 0;
- this.dx = this.velocity;
- } else if ( x + this.width > game.width ){
- this.x = game.width - this.width;
- this.dx = -this.velocity;
- } else if ( y < 0 ){
- this.y = 0;
- this.dy = this.velocity;
- } else if (y + this.height > game.height ){
- game.over("Game Over!");
- g_o.play();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement