Advertisement
Guest User

Untitled

a guest
Aug 18th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. checkBounds: function(){
  2.     var x = this.x + this.dx;
  3.     var y = this.y + this.dy;
  4.  
  5.     var g_o = new Audio();
  6.     g_o.src = "augame/game_over.mp3"
  7.  
  8.     if ( x < 0 ){
  9.       this.x = 0;
  10.       this.dx = this.velocity;
  11.     } else if ( x + this.width > game.width ){
  12.       this.x = game.width - this.width;
  13.       this.dx = -this.velocity;
  14.     } else if ( y < 0 ){
  15.       this.y = 0;
  16.       this.dy = this.velocity;
  17.     } else if (y + this.height > game.height ){
  18.       game.over("Game Over!");
  19.       g_o.play();
  20.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement