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
/**** * Classes ****/ // Define the Player class var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.createAsset('player', 'Player character', 0.5, 1); self.speed = 5; self.jumpPower = -22; self.gravity = 0.5; self.velocityY = 0; self.isJumping = false; self.isFlipping = false; self.flipRotation = 0; self.moveRight = function () { self.x += self.speed; }; self.jump = function () { if (!self.isJumping) { self.isJumping = true; self.velocityY = self.jumpPower; } }; self.update = function () { self.y += self.velocityY; self.velocityY += self.gravity; if (self.isFlipping) { playerGraphics.rotation += self.flipRotation; } // Check for ground collision if (self.y > game.height - playerGraphics.height) { self.y = game.height - playerGraphics.height; self.isJumping = false; self.isFlipping = false; playerGraphics.rotation = 0; } }; self.flip = function () { if (!self.isFlipping && self.isJumping) { self.isFlipping = true; self.flipRotation = Math.PI / 16; // 22.5 degrees per frame } }; }); // Define the Obstacle class var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.createAsset('obstacle', 'Obstacle', 0.5, 1); self.speed = -5; self.move = function () { self.x += self.speed; }; self.update = function () { self.move(); }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 // Init game with black background }); /**** * Game Code ****/ // Initialize important asset arrays var obstacles = []; var player = game.addChild(new Player()); // Set the player's starting position player.x = 2048 / 4; player.y = game.height - player.height; // Game tick event LK.on('tick', function () { // Update player player.update(); // Update obstacles for (var i = obstacles.length - 1; i >= 0; i--) { obstacles[i].update(); // Check for collision with player if (player.intersects(obstacles[i])) { // End game if collision occurs LK.showGameOver(); } // 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) { spawnRate = 30; } // Set a minimum spawn rate if (LK.ticks % spawnRate === 0) { var obstacle = new Obstacle(); obstacle.x = game.width; obstacle.y = game.height - obstacle.height; obstacles.push(obstacle); game.addChild(obstacle); } }); // Touch event listeners game.on('down', function (obj) { var touchPos = obj.event.getLocalPosition(game); if (touchPos.x > game.width / 2) { player.moveRight(); } else { player.jump(); } }); game.on('up', function (obj) { player.flip(); });
===================================================================
--- original.js
+++ change.js
@@ -88,11 +88,14 @@
obstacles[i].destroy();
obstacles.splice(i, 1);
}
}
- // Spawn obstacles
- if (LK.ticks % 120 === 0) {
- // Every 2 seconds
+ // Spawn obstacles with variable rate
+ var spawnRate = 120 - Math.floor(LK.ticks / 1800); // Decrease spawn rate every 30 seconds
+ if (spawnRate < 30) {
+ spawnRate = 30;
+ } // Set a minimum spawn rate
+ if (LK.ticks % spawnRate === 0) {
var obstacle = new Obstacle();
obstacle.x = game.width;
obstacle.y = game.height - obstacle.height;
obstacles.push(obstacle);
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.