User prompt
Poison should disappear after being touched by the snake
User prompt
The function of the poison will be similar to the food but in the negative side i.e., there will be a reduction in points
User prompt
Snake is not able to eat the purple box and the purple box is not showing any affect. correct that bug
User prompt
The purple box appears in the start of the game which is not correct instead the purple box which is poison will always appear after every 7-8 moves and the maximum limit for the purple box to appear will be 12. Further, the effect of the purple box is to reduce the size of snake by 2 box and reduce the point by -20 and also if the purple box should disappear after 10 second. Note: The yellow box functionality should not change.
User prompt
Please fix the bug: 'TypeError: setTimeout is not a function' in or related to this line: 'setTimeout(function () {' Line Number: 155
User prompt
Fix the necessary bugs
User prompt
fix the bug
User prompt
Fix the Bugs
User prompt
In the current game there are areas of improvement that has to be done. Based on the points given below do the necessary improvements accordingly. • The Game title and the Score are overlapping in the screen which makes it difficult to see the title and score, so separate both lives and score title. • Add a border line which doesn’t allows the snake to jump out of the screen i.e., when the snake touches the border line then the snake should bounce back to the viewport. • The snake movement is limited to x-axis so allow the snake to move in both X & Y axis. • Every time first the food should appear and randomly after 7-12 (number range varies from 7 to 12 times) turns along with the food the poison is also generated. Note: The poison will disappear after 10 second and again after the 7-12 turns the poison will reappear.
User prompt
When the game starts there are multiple food (yellow box) and poison (purple box) in the start, so have only 1 food/poison in the start and once it is consumed by the snake then the next food/poison will appear on the screen. Note: Food should be the first thing to appear by default.
Initial prompt
Snake Xenzia 2024
===================================================================
--- original.js
+++ change.js
@@ -44,11 +44,17 @@
}
};
self.update = function () {
var newHead = {
- x: Math.min(Math.max(self.segments[0].x + self.direction.x * self.speed, 0), 2048),
- y: Math.min(Math.max(self.segments[0].y + self.direction.y * self.speed, 0), 2732)
+ x: self.segments[0].x + self.direction.x * self.speed,
+ y: self.segments[0].y + self.direction.y * self.speed
};
+ if (newHead.x < 0 || newHead.x > 2048) {
+ self.direction.x *= -1;
+ }
+ if (newHead.y < 0 || newHead.y > 2732) {
+ self.direction.y *= -1;
+ }
if (self.grow) {
var newSegment = self.attachAsset('snakeSegment', {
anchorX: 0.5,
anchorY: 0.5
@@ -94,9 +100,9 @@
});
scoreTxt.anchor.set(0.5, 0);
livesTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
-LK.gui.topRight.addChild(livesTxt);
+LK.gui.topLeft.addChild(livesTxt);
function spawnFood() {
var food = new Food();
foods.push(food);
game.addChild(food);
@@ -149,16 +155,21 @@
game.down = function (x, y, obj) {
var head = snake.segments[0];
var dx = x - head.x;
var dy = y - head.y;
- var mag = Math.sqrt(dx * dx + dy * dy);
snake.direction = {
- x: dx / mag,
- y: dy / mag
+ x: dx,
+ y: dy
};
};
if (foods.length == 0) {
spawnFood();
-}
-if (poisons.length == 0) {
- spawnPoison();
+ if (Math.random() < 1 / 10) {
+ spawnPoison();
+ setTimeout(function () {
+ if (poisons.length > 0) {
+ poisons[0].destroy();
+ poisons.splice(0, 1);
+ }
+ }, 10000);
+ }
}
\ No newline at end of file
Apple. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Poisonous Skull. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pause icon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
heart icon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Snake Face. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Ostrich egg. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.