User prompt
please add a backdrop
User prompt
make the score increase by 1 everytime the player sucsesfully jumps over the enemy
User prompt
make the score text pastel pink
User prompt
add a score system everytime the player jumps over a enemy the score increases by 1
User prompt
make the enemys at the beginning slowly spawn as the game progress es the enemys spawn more often
User prompt
make the jump a little higher
User prompt
make the jump a litle bit higher
Initial prompt
kawaii parkour
===================================================================
--- original.js
+++ change.js
@@ -11,8 +11,11 @@
self.velocityY = 0;
self.isJumping = false;
self.isFlipping = false;
self.flipRotation = 0;
+ self.incrementScore = function () {
+ score++;
+ };
self.moveRight = function () {
self.x += self.speed;
};
self.jump = function () {
@@ -46,8 +49,9 @@
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.createAsset('obstacle', 'Obstacle', 0.5, 1);
self.speed = -5;
+ self.hasScored = false;
self.move = function () {
self.x += self.speed;
};
self.update = function () {
@@ -64,10 +68,11 @@
/****
* Game Code
****/
-// Initialize important asset arrays
+// Initialize important asset arrays and score
var obstacles = [];
+var score = 0;
var player = game.addChild(new Player());
// Set the player's starting position
player.x = 2048 / 4;
player.y = game.height - player.height;
@@ -77,18 +82,28 @@
player.update();
// Update obstacles
for (var i = obstacles.length - 1; i >= 0; i--) {
obstacles[i].update();
- // Check for collision with player
+ // Check for collision with player and if the player has jumped over an obstacle
if (player.intersects(obstacles[i])) {
// End game if collision occurs
LK.showGameOver();
+ } else if (player.y < obstacles[i].y && player.x > obstacles[i].x) {
+ // Increment score if player jumps over the obstacle
+ player.incrementScore();
+ // Ensure score is only incremented once per obstacle
+ obstacles[i].hasScored = true;
}
// Remove off-screen obstacles
if (obstacles[i].x + obstacles[i].width < 0) {
obstacles[i].destroy();
obstacles.splice(i, 1);
}
+ // Remove off-screen obstacles
+ if (obstacles[i].x + obstacles[i].width < 0) {
+ obstacles[i].destroy();
+ obstacles.splice(i, 1);
+ }
}
// Spawn obstacles with variable rate
var spawnRate = 120 - Math.floor(LK.ticks / 1800); // Decrease spawn rate every 30 seconds
if (spawnRate < 30) {
kawaii style kitten. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Kawaii style monster. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
kawaii style grass feild backdrop. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.