Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'addChild')' in or related to this line: 'LK.gui.top.right.addChild(bestScoreTxt);' Line Number: 482
Code edit (10 edits merged)
Please save this source code
User prompt
Migrate to the latest version of LK
Code edit (6 edits merged)
Please save this source code
User prompt
create a graphic for a spiky platform.
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -1,7 +1,45 @@
/****
* Classes
****/
+/*
+TODO:
+--------------------
+Bugs:
+* Consider shaft method for difficulty ramping.
+* The red platforms have to be really shining up in red, dangerous looking. maybe add spikes.
+* Now that player graphic is bigger, it sometimes collides with platforms from below. Either adjust size, spacing
+or jump height/logic.
+* The platforms array grows in length over time. Try to remove deleted elements from it, but make backup first,
+because this is where the AI started optimizing to make the game page freeze last time.
+* Player should have three lives - shown as little red hearts in top right corner.
+---------------------
+Interface/graphics:
+* Show instructions on screen at start.
+--------------
+Powerup ideas:
+* A powerup that removes all nearby platforms and give score for them.
+* Maybe make a disco powerup that changes light, colors or visuals somehow.
+* Consider platforms that increase or decrease the size/weight of the character.
+* Or maybe just a platform with a piece of cake on it, and when player lands there he gets 10 points and swells up
+(no gameplay side effects) for 5 seconds. Could actually be all kinds of funny pickups like that.
+* Different hats that the player will wear until a new one is picked up?
+----------
+Gameplay:
+* Consider difficulty ramping. More red platforms?
+* Make sure red platforms never fully block the way. Platforms have row and column id's to pattern match against.
+-----------
+Theming:
+* Consider possible player character.
+* A frog? A kangaroo? A spring? A tennisball? A rabbit? A two-headed squirrel? Something on a pogostick?
+* A Rick Dangerous finding treasures on the platforms?
+* A Pirate Ship finding bounty on platforms? Maybe beats platforms with less strength than they have?
+* A cat eating sushi on each platform?
+* A princess saving animals on every tenth platform?
+* Maybe all those characters, each triggered by a powerup until a new one is picked up.
+* Maybe new mode unlocked per 200 platforms or so?
+----------
+*/
var ScoreLabel = Container.expand(function (scoreValue, posX, posY) {
var self = Container.call(this);
var scoreText = new Text2(scoreValue.toString(), {
size: 150,
@@ -29,45 +67,8 @@
self.updateScore = function (newScore) {
scoreText.setText(newScore.toString());
};
});
-/*
-TODO:
---------------------
-Bugs:
-The red platforms have to be really shining up in red, dangerous looking. maybe add spikes.
-Now that player graphic is bigger, it sometimes collides with platforms from below. Either adjust size, spacing
-or jump height/logic.
-The platforms array grows in length over time. Try to remove deleted elements from it, but make backup first,
-because this is where the AI started optimizing to make the game page freeze last time.
-Player should have three lives - shown as little red hearts in top right corner.
----------------------
-Interface/graphics:
-Show instructions on screen at start.
---------------
-Powerup ideas:
-A powerup that removes all nearby platforms and give score for them.
-Maybe make a disco powerup that changes light, colors or visuals somehow.
-Consider platforms that increase or decrease the size/weight of the character.
-Or maybe just a platform with a piece of cake on it, and when player lands there he gets 10 points and swells up
-(no gameplay side effects) for 5 seconds. Could actually be all kinds of funny pickups like that.
-Different hats that the player will wear until a new one is picked up?
-----------
-Gameplay:
-Consider difficulty ramping. More red platforms?
-Make sure red platforms never fully block the way. Probably means platforms should have row-id's, so rows can be checked.
------------
-Theming:
-Consider possible player character.
-A frog? A kangaroo? A spring? A tennisball? A rabbit? A two-headed squirrel? Something on a pogostick?
-A Rick Dangerous finding treasures on the platforms?
-A Pirate Ship finding bounty on platforms? Maybe beats platforms with less strength than they have?
-A cat eating sushi on each platform?
-A princess saving animals on every tenth platform?
-Maybe all those characters, each triggered by a powerup until a new one is picked up.
-Maybe new mode unlocked per 200 platforms or so?
-----------
-*/
var PlayerScoreLabel = Container.expand(function () {
var self = Container.call(this);
var scoreText = new Text2('0', {
size: 150,
@@ -336,21 +337,17 @@
}
} else {
if (self.x > 500 && self.x < 1548) {
self.x += self.velocity.x;
- } else {
+ } /*else {
platforms.forEach(function (platform) {
- platform.x -= self.velocity.x;
+ 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;
- });
- }
+ platforms.forEach(function (platform) {
+ platform.y -= self.velocity.y;
+ });
}
};
// Function to bounce the ball off platforms with a bounce counter
self.bounceCounter = 0;
@@ -380,9 +377,9 @@
self.attachAsset('newDeathSpriteId', {
anchorX: 0.5,
anchorY: 0.5
});
- LK.effects.flashObject(ball.getChildAt(0), '0xff0000', 1000);
+ //LK.effects.flashObject(a, 0xff0000, 1000);
self.fallingActivated = true;
gameEnding = true;
//ballGraphics.texture = LK.getAsset('newDeathSpriteId', {}).texture;
//LK.showGameOver();
@@ -469,11 +466,11 @@
/****
* Game Code
****/
-//LK.init.shape('sideBarrier', {width:100, height:100, color:0xff0000, shape:'box'})
-// Create background graphic and add it to the game
// Initialize background graphic asset
+// Create background graphic and add it to the game
+//LK.init.shape('sideBarrier', {width:100, height:100, color:0xff0000, shape:'box'})
var backgroundGraphic = game.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
@@ -664,8 +661,13 @@
});
} else {
if (LK.ticks % 120 == 0) {
console.log('Platforms.length is now: ' + platforms.length);
+ console.log('platforms[end]:' + platforms[platforms.length - 1]);
+ var filteredPlatforms = platforms.filter(function (platform) {
+ return platform.hasOwnProperty('powerup'); //.powerup == false;
+ });
+ platforms = filteredPlatforms;
}
scoreLabels.forEach(function (scoreLabel) {
if (scoreLabel.update) {
scoreLabel.update();
@@ -696,18 +698,48 @@
platforms.forEach(function (platform) {
if (platform.update) {
platform.update();
}
- if (platform instanceof ScoreLabel) {
+ /*if (platform instanceof ScoreLabel) {
platform.update();
- } else if (platform.y < -900) {
+ } 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.alpha = Math.random() < 0.55 ? 1 : 0;
platform.toxic = Math.random() < 0.1 ? true : false;
+ //platform.setTint();
+ // Make a shaft
+ var rowRel = platform.row % 100;
+ if (platform.col == 0) {
+ if (rowRel > 10 && rowRel < 20) {
+ platform.alpha = rowRel == 19 ? 1 : 0;
+ platform.toxic = false;
+ }
+ } else if (platform.col == 1) {
+ if (rowRel > 70 && rowRel < 80) {
+ platform.alpha = rowRel == 79 ? 1 : 0;
+ platform.toxic = false;
+ }
+ } else if (platform.col == 2) {
+ if (rowRel > 30 && rowRel < 40) {
+ platform.alpha = rowRel == 39 ? 1 : 0;
+ platform.toxic = false;
+ }
+ } else if (platform.col == 3) {
+ if (rowRel > 90 && rowRel < 100) {
+ platform.alpha = rowRel == 99 ? 1 : 0;
+ platform.toxic = false;
+ }
+ } else if (platform.col == 4) {
+ if (rowRel > 50 && rowRel < 60) {
+ platform.alpha = rowRel == 59 ? 1 : 0;
+ platform.toxic = 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) {
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