User prompt
make every block two times bigger
User prompt
make sure block spawn every two secounds
User prompt
Fix Bug: 'ReferenceError: Block is not defined' in this line: 'var obstacleTypes = [Block, Obstacle, BouncePad, SpikeBlock, Boulder];' Line Number: 152
User prompt
spawn obsticle every secound
User prompt
nespawn obsticle every secound delete class wallblock
User prompt
only spawn wall block every 25 seconds
User prompt
make sure to only spawn block, spike block, bouncepad,wallblock, boulder,
User prompt
only spawn a wall block every 15 secounds
User prompt
make sure block spawns are random
User prompt
make sure to spawn other blocks besides bounce and wallblock
User prompt
make sure a wal blocks spawn 7 secounds after start
User prompt
make sure bounce pads spawn 2 secounds before a wallblock
User prompt
make sure the wallblock is always behind a bounce pad
User prompt
before a wallblock apears spawn in a bounce pad
User prompt
make sur ethe bounce pad spawns before the wall apears
User prompt
spawn bounce pad right next to wall block every time it spawns
User prompt
Fix Bug: 'ReferenceError: Boulder is not defined' in this line: 'newObstacle = new Boulder();' Line Number: 133
User prompt
makee a wall block that is longer than a boulder
User prompt
make bounce pad move to you like an obsticle but it makes you jump higer
User prompt
make bounce padd act like a block
User prompt
make bounce pad class that makes you jump higer than usual
User prompt
create class fir biunce pad
User prompt
make a bounce pad that makes you jump higer than a regular jump
User prompt
Fix Bug: 'ReferenceError: Block is not defined' in this line: 'if (player.intersects(obstacles[i]) && !(obstacles[i] instanceof Block && !obstacles[i].isHarmful())) {' Line Number: 100
User prompt
Fix Bug: 'ReferenceError: Block is not defined' in this line: 'var obstacleType = Math.random() < 0.33 ? Obstacle : Math.random() < 0.5 ? Block : Boulder;' Line Number: 111
/**** * Classes ****/ /**** // Block class var Block = Container.expand(function () { var self = Container.call(this); var blockGraphics = self.createAsset('block', 'Regular Block', 0.5, 1); blockGraphics.scale.set(1.6); // Two times bigger than the original size self.speed = Obstacle.baseSpeed; self.move = function () { self.x -= self.speed; if (self.x < -blockGraphics.width) { self.destroy(); } }; }); * Classes ****/ // 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.isJumping = false; self.isFlipping = false; self.isDashing = false; self.jumpHeight = -22; self.gravity = 0.5; self.velocityY = 0; self.jump = function () { if (!self.isJumping) { self.isJumping = true; self.velocityY = self.jumpHeight; } }; self.flip = function () { if (self.isJumping && !self.isFlipping) { self.isFlipping = true; playerGraphics.rotation += Math.PI; } }; self.dash = function () { if (self.isJumping && !self.isDashing) { self.isDashing = true; self.x += 50; } }; self.update = function () { if (self.isJumping) { self.y += self.velocityY; self.velocityY += self.gravity; if (self.y > game.height - playerGraphics.height) { self.y = game.height - playerGraphics.height; self.isJumping = false; self.isFlipping = false; self.isDashing = false; playerGraphics.rotation = 0; } } }; }); // Obstacle class var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.createAsset('obstacle', 'Obstacle', 0.5, 1); obstacleGraphics.scale.set(0.8); self.speed = Obstacle.baseSpeed; self.move = function () { self.x -= self.speed; if (self.x < -obstacleGraphics.width) { self.destroy(); } }; }); // BouncePad class var BouncePad = Container.expand(function () { var self = Container.call(this); var bouncePadGraphics = self.createAsset('bouncePad', 'Bounce Pad', 0.5, 1); bouncePadGraphics.scale.set(1.6); // Two times bigger than the original size self.move = function () { self.x -= Obstacle.baseSpeed; if (self.x < -bouncePadGraphics.width) { self.destroy(); } }; }); // SpikeBlock class var SpikeBlock = Container.expand(function () { var self = Container.call(this); var spikeBlockGraphics = self.createAsset('spikeBlock', 'Spike Block', 0.5, 1); spikeBlockGraphics.scale.set(1.2); // Two times bigger than the original size self.speed = Obstacle.baseSpeed; self.move = function () { self.x -= self.speed; if (self.x < -spikeBlockGraphics.width) { self.destroy(); } }; }); // Boulder class var Boulder = Container.expand(function () { var self = Container.call(this); var boulderGraphics = self.createAsset('boulder', 'Boulder', 0.5, 1); boulderGraphics.scale.set(2.0); // Two times bigger than the original size self.speed = Obstacle.baseSpeed; self.move = function () { self.x -= self.speed; if (self.x < -boulderGraphics.width) { self.destroy(); } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 // Init game with black background }); /**** * Game Code ****/ // Initialize player Obstacle.baseSpeed = 3; Obstacle.increaseSpeed = function () { Obstacle.baseSpeed += 1; }; var player = game.addChild(new Player()); player.x = game.width / 4; player.y = game.height - 150; // Initialize obstacles array var obstacles = []; // Game tick event LK.on('tick', function () { player.update(); // Move each obstacle and check for collisions for (var i = obstacles.length - 1; i >= 0; i--) { obstacles[i].move(); if (player.intersects(obstacles[i])) { if (obstacles[i] instanceof BouncePad) { player.velocityY = player.jumpHeight * 1.5; // 50% higher jump player.isJumping = true; } else { LK.effects.flashScreen(0xff0000, 500); LK.showGameOver(); } } } // Randomly spawn obstacles if (LK.ticks % 120 === 0) { var obstacleTypes = [Obstacle, BouncePad, SpikeBlock, Boulder]; var ObstacleType = obstacleTypes[Math.floor(Math.random() * obstacleTypes.length)]; var newObstacle = new ObstacleType(); newObstacle.x = game.width; newObstacle.y = game.height - newObstacle.height / 2; obstacles.push(newObstacle); game.addChild(newObstacle); } }); // Keyboard event listener to make the player jump game.on('down', function (obj) { player.jump(); }); game.on('move', function (obj) { var pos = obj.event.getLocalPosition(game); if (pos.x > game.width / 2) { player.dash(); } else { player.flip(); } }); game.on('up', function (obj) { // Up event not used in this game });
===================================================================
--- original.js
+++ change.js
@@ -4,9 +4,9 @@
/**** // Block class
var Block = Container.expand(function () {
var self = Container.call(this);
var blockGraphics = self.createAsset('block', 'Regular Block', 0.5, 1);
-blockGraphics.scale.set(0.8); // Same size as a spike block
+blockGraphics.scale.set(1.6); // Two times bigger than the original size
self.speed = Obstacle.baseSpeed;
self.move = function () {
self.x -= self.speed;
if (self.x < -blockGraphics.width) {
@@ -75,9 +75,9 @@
// BouncePad class
var BouncePad = Container.expand(function () {
var self = Container.call(this);
var bouncePadGraphics = self.createAsset('bouncePad', 'Bounce Pad', 0.5, 1);
- bouncePadGraphics.scale.set(0.8);
+ bouncePadGraphics.scale.set(1.6); // Two times bigger than the original size
self.move = function () {
self.x -= Obstacle.baseSpeed;
if (self.x < -bouncePadGraphics.width) {
self.destroy();
@@ -87,9 +87,9 @@
// SpikeBlock class
var SpikeBlock = Container.expand(function () {
var self = Container.call(this);
var spikeBlockGraphics = self.createAsset('spikeBlock', 'Spike Block', 0.5, 1);
- spikeBlockGraphics.scale.set(0.6); // Smaller than a wall block
+ spikeBlockGraphics.scale.set(1.2); // Two times bigger than the original size
self.speed = Obstacle.baseSpeed;
self.move = function () {
self.x -= self.speed;
if (self.x < -spikeBlockGraphics.width) {
@@ -100,9 +100,9 @@
// Boulder class
var Boulder = Container.expand(function () {
var self = Container.call(this);
var boulderGraphics = self.createAsset('boulder', 'Boulder', 0.5, 1);
- boulderGraphics.scale.set(1.0); // Same size as a wall block
+ boulderGraphics.scale.set(2.0); // Two times bigger than the original size
self.speed = Obstacle.baseSpeed;
self.move = function () {
self.x -= self.speed;
if (self.x < -boulderGraphics.width) {