Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. var randomX = Math.floor(Math.random() * 40) * squaresize;
  2. var randomY = Math.floor(Math.random() * 30) * squaresize;+
  3.  
  4. // add new sprite
  5. apple = game.add.sprite(randomX, randomY, 'apple');
  6.  
  7.  
  8. for(var i = 0; i < snake.length; i++) {
  9. if(snake[1].x == apple.x && snake[1].y == apple-y){
  10. // Next time the snake moves , a now block will be added to its new length
  11.  
  12. addNew = true;
  13.  
  14. // destroy the old apple,
  15. apple.destroy();
  16.  
  17. // make a new randomize appleCollision
  18. this.
  19.  
  20. },
  21.  
  22. appleCollision: function() {
  23.  
  24. },
  25.  
  26. selfCollision: function() {
  27.  
  28. },
  29.  
  30. wallCollision: function() {
  31.  
  32. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement