User prompt
find the bugs in my code.
Code edit (1 edits merged)
Please save this source code
User prompt
add esc key to exit the game.
User prompt
Please fix the bug: 'Timeout.tick error: Cannot set properties of undefined (setting 'tint')' in or related to this line: 'obstacle.obstacleGraphics.tint = obstacle.colors[obstacle.colorIndex];' Line Number: 90
Code edit (7 edits merged)
Please save this source code
User prompt
Obstacle colors are not different, it should be different for each obstacle in line.
User prompt
do not change the player color on hit.
User prompt
still after hitting the same color obstacle it is showing game over.
User prompt
Game over logic has a problem and each color should be present in the grid line ( Red, Green, Blue, yellow )
Code edit (1 edits merged)
Please save this source code
User prompt
add debug print after on player intersects function.
Code edit (1 edits merged)
Please save this source code
User prompt
Every obstacle in single grid line should have different color
User prompt
4 obstacle should have different color from : red, green, blue, yellow
User prompt
Obstacle should come down in Grid line not in random places and only 4 obstacles per line with all the colors : red, blue, green, yellow
User prompt
Now i want the Core Mechanics to : - Player Pawn will switch the color between : Red, Blue, Green, Yellow - 4 Obstacle will come down in random order of colors : Red, Blue, Green, Yellow - Now Player need to hit the obstacle of same color as itself - After hitting the player pawn color again randomly change between : Red, Blue, Green, Yellow - On Each Hit Player will Get One Point
User prompt
instead of Using Random Color use Constant value of : Red, Blue, Green, Yellow And then if the obstacle hitting the pawn is Green : increase the Score else if The obstacle hitting the pawn is Red, Blue, or Yellow : Game Over.
User prompt
Initial Score : 0 Add Score display on To right corner Game over Condition : When player hits the Non-green obstacle Add Logic for Obstacle Color Check.
User prompt
Game should over when player pawn hits an obstacles it should only over when the players score is -1.
User prompt
make a player pawn size little bit wider and change the game logic to collect only green obstacle to increase the score else reduce the score and if the score is less than 0 then game over.
User prompt
make player pawn in box shape
User prompt
Show the score at game over
User prompt
obstacles should come in random colors.
User prompt
Change obstacle to Noisy shapes
User prompt
Make it more realistic
===================================================================
--- original.js
+++ change.js
@@ -79,13 +79,17 @@
if (obstacles[i].tint == 0x00FF00) {
LK.setScore(LK.getScore() + 1);
} else {
LK.setScore(LK.getScore() - 1);
+ if (obstacles[i].tint != 0x00FF00) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver("Your score: " + LK.getScore());
+ }
+ if (obstacles[i].tint != 0x00FF00) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver("Your score: " + LK.getScore());
+ }
}
- if (LK.getScore() == -1) {
- LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver("Your score: " + LK.getScore());
- }
}
}
};
// Handle touch/mouse move
@@ -98,5 +102,12 @@
};
// Handle touch/mouse up
game.up = function (x, y, obj) {
// No action needed on up event
-};
\ No newline at end of file
+};
+// Add score display
+var scoreTxt = new Text2('0', {
+ size: 150,
+ fill: "#ffffff"
+});
+scoreTxt.anchor.set(1, 0); // Sets anchor to the right of the top edge of the text.
+LK.gui.topRight.addChild(scoreTxt);
\ No newline at end of file