User prompt
Don’t change initial touch position in the move metgod
User prompt
Use an angle for snake movement rather than direction indicators
User prompt
Allow the snake to move in any direction
User prompt
Where I originally touch the screen a touch indicator should be added
User prompt
Snake should move continuously, up down left or right. You change the direction by swiping up down left or right
User prompt
The snake is made up of a head and x amount of body parts
Initial prompt
Snake game
var TouchIndicator = Container.expand(function () { var self = Container.call(this); var touchIndicatorGraphics = self.createAsset('touchIndicator', 'Touch Indicator Graphics', 0.5, 0.5); }); var Snake = Container.expand(function () { var self = Container.call(this); var snakeGraphics = self.createAsset('snake', 'Snake Graphics', .5, .5); self.direction = { x: 0, y: 0 }; self.speed = 5; self.angle = 0; self.move = function () { self.x += Math.cos(self.angle) * self.speed; self.y += Math.sin(self.angle) * self.speed; }; }); var Food = Container.expand(function () { var self = Container.call(this); var foodGraphics = self.createAsset('food', 'Food Graphics', .5, .5); self.spawn = function () {}; }); var Game = Container.expand(function () { var self = Container.call(this); var snake = self.addChild(new Snake()); var foods = []; snake.x = 2048 / 2; snake.y = 2732 / 2; var food = new Food(); food.spawn(); foods.push(food); self.addChild(food); var dragNode = null; var initialTouchPosition = { x: 0, y: 0 }; var touchIndicator = null; stage.on('down', function (obj) { var event = obj.event; initialTouchPosition = event.getLocalPosition(self); if (touchIndicator) { touchIndicator.destroy(); } touchIndicator = self.addChild(new TouchIndicator()); touchIndicator.x = initialTouchPosition.x; touchIndicator.y = initialTouchPosition.y; }); function handleMove(obj) { var event = obj.event; var currentTouchPosition = event.getLocalPosition(self); var dx = currentTouchPosition.x - initialTouchPosition.x; var dy = currentTouchPosition.y - initialTouchPosition.y; snake.angle = Math.atan2(dy, dx); } stage.on('move', handleMove); LK.on('tick', function () { snake.move(); for (var i = 0; i < foods.length; i++) { if (snake.intersects(foods[i])) { foods[i].destroy(); foods.splice(i, 1); var newFood = new Food(); newFood.spawn(); foods.push(newFood); self.addChild(newFood); } } }); });
===================================================================
--- original.js
+++ change.js
@@ -52,9 +52,8 @@
var currentTouchPosition = event.getLocalPosition(self);
var dx = currentTouchPosition.x - initialTouchPosition.x;
var dy = currentTouchPosition.y - initialTouchPosition.y;
snake.angle = Math.atan2(dy, dx);
- initialTouchPosition = currentTouchPosition;
}
stage.on('move', handleMove);
LK.on('tick', function () {
snake.move();
Single, Anaconda snake head segment. Seen from above. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Single snake head segment. Seen from above. Cartoon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Golden Apple Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Bright Amazing games background for modern snake game. It should be epic!
White circular touch indicator. White button like look. Game asset. No background. 2d. No shadow.