Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
make this line work: ballGraphics.texture = LK.getAsset('newDeathSpriteId', {}).texture;
User prompt
Fix Bug: 'TypeError: ballGraphics.setTextureFromAsset is not a function' in or related to this line: '_iterator.f();' Line Number: 429
User prompt
Fix Bug: 'TypeError: ballGraphics.setTexture is not a function' in or related to this line: '_iterator.f();' Line Number: 429
User prompt
in the deathanim function, ball sprite should change to another one.
Code edit (10 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setText')' in or related to this line: '_iterator.f();' Line Number: 466
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setText')' in or related to this line: '_iterator.f();' Line Number: 466
Code edit (1 edits merged)
Please save this source code
User prompt
Every time the player gets points, they should be multiplied by the variable (multiplier-1).
User prompt
Every time the player gets points, they should be multiplied by the variable (multiplier-1).
Code edit (1 edits merged)
Please save this source code
Code edit (7 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'toString')' in or related to this line: 'mulText.setText('x' + newVal.toString());' Line Number: 176
User prompt
Fix Bug: 'ReferenceError: valText is not defined' in or related to this line: 'valText.anchor.set(0.5, 0.5);' Line Number: 173
Code edit (3 edits merged)
Please save this source code
User prompt
scorelabels should fly off in a random upwards direction instead of just up.
Code edit (1 edits merged)
Please save this source code
User prompt
add all created scorelabels to the scoreLabels array on creation.
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'update')' in or related to this line: 'self.scoreLabel.update();' Line Number: 323
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'update')' in or related to this line: 'self.scoreLabel.update();' Line Number: 323
Code edit (1 edits merged)
Please save this source code
User prompt
call the scorelabel's update method in the on tick loop, or in ball update
===================================================================
--- original.js
+++ change.js
@@ -310,26 +310,46 @@
y: -20
};
self.immunity = 0;
self.followers = 0;
+ self.fallingActivated = false;
+ self.vely = 1;
// Function to update ball position
self.update = function () {
- if (self.x > 500 && self.x < 1548) {
- self.x += self.velocity.x;
+ if (this.fallingActivated) {
+ /*
+ if (self.x > 1024) {
+ this.x -= 4;
+ } else {
+ this.x += 4;
+ }*/
+ this.vely *= 1.1;
+ this.width *= 1.02;
+ this.height *= 1.02;
+ this.rotation = -Math.PI / 4;
+ this.y += this.vely / 5;
+ this.zIndex = 10000;
+ if (self.width > 1000) {
+ self.destroy();
+ LK.showGameOver();
+ }
} else {
- platforms.forEach(function (platform) {
- platform.x -= self.velocity.x;
- });
+ if (self.x > 500 && self.x < 1548) {
+ self.x += self.velocity.x;
+ } else {
+ platforms.forEach(function (platform) {
+ platform.x -= self.velocity.x;
+ });
+ }
+ self.velocity.y += 1; // simple gravity
+ if (self.y < 500) {
+ self.y += self.velocity.y;
+ } else {
+ platforms.forEach(function (platform) {
+ platform.y -= self.velocity.y;
+ });
+ }
}
- self.velocity.y += 1; // simple gravity
- if (self.y < 500) {
- self.y += self.velocity.y;
- } else {
- platforms.forEach(function (platform) {
- platform.y -= self.velocity.y;
- });
- }
- // Removed update call on scoreLabel as it is undefined and causing TypeError.
};
// Function to bounce the ball off platforms with a bounce counter
self.bounceCounter = 0;
self.bounce = function (platforms) {
@@ -352,10 +372,18 @@
}
break;
}
if (platform.toxic) {
- ballGraphics.texture = LK.getAsset('newDeathSpriteId', {}).texture;
- LK.showGameOver();
+ self.removeChild(self.getChildAt(0));
+ //platform.attachAsset('powerupFollowFree', {
+ self.attachAsset('newDeathSpriteId', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.fallingActivated = true;
+ gameEnding = true;
+ //ballGraphics.texture = LK.getAsset('newDeathSpriteId', {}).texture;
+ //LK.showGameOver();
break;
}
//self.velocity.y = -20;
self.velocity.y *= -1;
@@ -543,8 +571,9 @@
var moveRightFrames = 0;
var rowAmount = 13;
var maxDepth = 0;
var multiplier = 2;
+var gameEnding = false;
// Create player score label
var playerScoreLabel = new PlayerScoreLabel();
LK.gui.top.addChild(playerScoreLabel);
var maxDepthLabel = new DepthLabel();
@@ -617,106 +646,118 @@
// Add event listener for touch down
game.on('down', handleMove);
// Game tick event
LK.on('tick', function () {
- if (LK.ticks % 120 == 0) {
- console.log('Platforms.length is now: ' + platforms.length);
- }
- scoreLabels.forEach(function (scoreLabel) {
- if (scoreLabel.update) {
- scoreLabel.update();
- }
- });
- // Update ball position
- ball.update(platforms);
- // Check for ball bouncing off platforms
- ball.bounce(platforms);
- if (moveLeftFrames > 0) {
- moveLeftFrames--;
- /*
+ if (gameEnding) {
+ ball.update(platforms);
platforms.forEach(function (platform) {
- platform.x -= 40;
+ if (platform.update) {
+ platform.update();
+ }
+ if (platform instanceof ScoreLabel) {
+ platform.alpha--;
+ }
});
- */
- ball.x -= 40;
- }
- if (moveRightFrames > 0) {
- moveRightFrames--;
- /*
- platforms.forEach(function (platform) {
- platform.x += 40;
+ } else {
+ if (LK.ticks % 120 == 0) {
+ console.log('Platforms.length is now: ' + platforms.length);
+ }
+ scoreLabels.forEach(function (scoreLabel) {
+ if (scoreLabel.update) {
+ scoreLabel.update();
+ }
});
- */
- ball.x += 40;
- }
- platforms.forEach(function (platform) {
- if (platform.update) {
- platform.update();
+ // Update ball position
+ ball.update(platforms);
+ // Check for ball bouncing off platforms
+ ball.bounce(platforms);
+ if (moveLeftFrames > 0) {
+ moveLeftFrames--;
+ /*
+ platforms.forEach(function (platform) {
+ platform.x -= 40;
+ });
+ */
+ ball.x -= 40;
}
- if (platform instanceof ScoreLabel) {
- platform.update();
- } else if (platform.y < -900) {
- platform.y += rowAmount * 300;
- platform.row += rowAmount;
- // Only randomize normal platforms, not sidebarriers.
- if (platform.height < 100) {
- //platform.alpha = Math.random() < 0.5 ? 1 : 0.2;
- platform.alpha = Math.random() < 0.5 ? 1 : 0;
- platform.toxic = Math.random() < 0.1 ? true : false;
- platform.setTint();
- // Chance that powerups are spawned on normal platforms
- if (platform.alpha == 1 && platform.powerup == false && !platform.toxic) {
- if (Math.random() < 0.01) {
- var t = new PowerupBurst();
- t.x = platform.x;
- t.y = platform.y - t.height;
- platforms.push(t);
- game.addChild(t);
- } else if (platform.row % 25 == 0 && Math.random() < 0.5) {
- var t = new PowerupScore();
- t.x = platform.x;
- t.y = platform.y - t.height;
- t.scoreVal = platform.row;
- t.updateLabel(t.scoreVal);
- platforms.push(t);
- game.addChild(t);
- } else if (Math.random() < 0.1) {
- var t = new PowerupMultiply();
- t.x = platform.x;
- t.y = platform.y - t.height;
- platforms.push(t);
- game.addChild(t);
- } else if (Math.random() < 0.1) {
- if (maxDepth < 30) {
- var t = new PowerupFollow();
- } else if (maxDepth < 100) {
- if (Math.random() < 0.5) {
+ if (moveRightFrames > 0) {
+ moveRightFrames--;
+ /*
+ platforms.forEach(function (platform) {
+ platform.x += 40;
+ });
+ */
+ ball.x += 40;
+ }
+ platforms.forEach(function (platform) {
+ if (platform.update) {
+ platform.update();
+ }
+ if (platform instanceof ScoreLabel) {
+ platform.update();
+ } else if (platform.y < -900) {
+ platform.y += rowAmount * 300;
+ platform.row += rowAmount;
+ // Only randomize normal platforms, not sidebarriers.
+ if (platform.height < 100) {
+ //platform.alpha = Math.random() < 0.5 ? 1 : 0.2;
+ platform.alpha = Math.random() < 0.5 ? 1 : 0;
+ platform.toxic = Math.random() < 0.1 ? true : false;
+ platform.setTint();
+ // Chance that powerups are spawned on normal platforms
+ if (platform.alpha == 1 && platform.powerup == false && !platform.toxic) {
+ if (Math.random() < 0.01) {
+ var t = new PowerupBurst();
+ t.x = platform.x;
+ t.y = platform.y - t.height;
+ platforms.push(t);
+ game.addChild(t);
+ } else if (platform.row % 25 == 0 && Math.random() < 0.5) {
+ var t = new PowerupScore();
+ t.x = platform.x;
+ t.y = platform.y - t.height;
+ t.scoreVal = platform.row;
+ t.updateLabel(t.scoreVal);
+ platforms.push(t);
+ game.addChild(t);
+ } else if (Math.random() < 0.1) {
+ var t = new PowerupMultiply();
+ t.x = platform.x;
+ t.y = platform.y - t.height;
+ platforms.push(t);
+ game.addChild(t);
+ } else if (Math.random() < 0.1) {
+ if (maxDepth < 30) {
var t = new PowerupFollow();
+ } else if (maxDepth < 100) {
+ if (Math.random() < 0.5) {
+ var t = new PowerupFollow();
+ } else {
+ var t = new PowerupBluebird();
+ }
+ } else if (maxDepth < 200) {
+ var r = Math.random();
+ if (r < 0.33) {
+ var t = new PowerupFollow();
+ } else if (r < 0.66) {
+ var t = new PowerupBluebird();
+ } else {
+ var t = new PowerupGreenbird();
+ }
} else {
var t = new PowerupBluebird();
}
- } else if (maxDepth < 200) {
- var r = Math.random();
- if (r < 0.33) {
- var t = new PowerupFollow();
- } else if (r < 0.66) {
- var t = new PowerupBluebird();
- } else {
- var t = new PowerupGreenbird();
- }
- } else {
- var t = new PowerupBluebird();
+ t.x = platform.x;
+ t.y = platform.y - t.height;
+ platforms.push(t);
+ game.addChild(t);
}
- t.x = platform.x;
- t.y = platform.y - t.height;
- platforms.push(t);
- game.addChild(t);
}
}
+ // Powerups don't automatically respawn below when they move off screen top edge.
+ if (platform.powerup == true) {
+ platform.destroy();
+ }
}
- // Powerups don't automatically respawn below when they move off screen top edge.
- if (platform.powerup == true) {
- platform.destroy();
- }
- }
- });
+ });
+ }
});
\ No newline at end of file
A happy blue elephant.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
erase.
Make the bird sit inside a birdcage.
Three green arrows pointing down.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A sad little bluebird sitting down.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A happy little bluebird flying.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A happy little green bird flying.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A lush jungle scenery with huge old trees covered in vines and overwrowth, blue sky and forested mountains in the background.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A dark wooden message board with vines and jungle moss growing on top.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A happy little blue elephant, looking scared, facing the viewer, legs flailing as it falls through the air.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A delicious peanut.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
delete