Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var randomX = Math.floor(Math.random() * 40) * squaresize;
- var randomY = Math.floor(Math.random() * 30) * squaresize;+
- // add new sprite
- apple = game.add.sprite(randomX, randomY, 'apple');
- for(var i = 0; i < snake.length; i++) {
- if(snake[1].x == apple.x && snake[1].y == apple-y){
- // Next time the snake moves , a now block will be added to its new length
- addNew = true;
- // destroy the old apple,
- apple.destroy();
- // make a new randomize appleCollision
- this.
- },
- appleCollision: function() {
- },
- selfCollision: function() {
- },
- wallCollision: function() {
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement