Code edit (1 edits merged)
Please save this source code
User prompt
in adjustScore replace scoreText.setText(String(score).padStart(6, '0')); by a the kgCollected with 2 digits
Code edit (4 edits merged)
Please save this source code
User prompt
when collecting a detritus add 0.01 to kgCollected
Code edit (9 edits merged)
Please save this source code
User prompt
extract this code : self.body.torso.tint = 0xff0000; // Tint the player's torso red self.body.legUpperLeft.children[0].tint = 0xff0000; // Tint the player's upper left leg red self.body.legUpperRight.children[0].tint = 0xff0000; // Tint the player's upper right leg red self.body.armUpperLeft.children[0].tint = 0xff0000; // Tint the player's upper left arm red self.body.armUpperRight.children[0].tint = 0xff0000; // Tint the player's upper right arm red self.body.armLowerLeft.tint = 0xff0000; self.body.armLowerRight.tint = 0xff0000; self.body.legLowerLeft.tint = 0xff0000; self.body.legLowerRight.tint = 0xff0000; self.body.pelvis.tint = 0xff0000; // Tint the player's pelvis red self.body.head.tint = 0xff0000; // Tint the player's head red self.body.footRight.tint = 0xff0000; self.body.footLeft.tint = 0xff0000; to a global function. user player global variable and make the color a parameter
Code edit (1 edits merged)
Please save this source code
User prompt
like for torso : self.body.torso.tint = 0xff0000; // Tint the player red Tint every other part in red when player fall in reiver
User prompt
in playerbody, like for torso, add a public property for each asset but dont replace existing local variables, just add new properties: example : var pelvis = ...; // Don't touch that self.pelvis = pelvis; // Add that
User prompt
Please fix the bug: 'ReferenceError: torso is not defined' in or related to this line: 'self.pelvis = self.attachAsset('pelvis', {' Line Number: 540
User prompt
in playerbody, like for torso, add a public property for each asset
Code edit (21 edits merged)
Please save this source code
User prompt
when player hits river, tint the player all in red
User prompt
when player hits river, tint it all in red
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
play slide sound when sliding
Code edit (7 edits merged)
Please save this source code
User prompt
in callGameOver wait 1sec befaore falling gameover
Code edit (1 edits merged)
Please save this source code
User prompt
adapt the speed of the jump and the speed of the fall to the player speed.
User prompt
make that at high speed player don't jump too far because of its speed
Code edit (2 edits merged)
Please save this source code
User prompt
adapt jump and gravity to speed so that at high speed player doesn't jump too far becaus of speed
===================================================================
--- original.js
+++ change.js
@@ -20,16 +20,16 @@
lavaBubbles.push(bubble);
}
// Update function to animate the lava bubbles
self.update = function () {
- if (LK.ticks % 20 == 0) {
+ if (LK.ticks % 10 == 0) {
// Emit a bubble every second
createLavaBubble();
}
for (var i = lavaBubbles.length - 1; i >= 0; i--) {
var bubble = lavaBubbles[i];
bubble.y -= 2; // Move bubble upwards
- bubble.alpha -= 0.02; // Fade out bubble
+ bubble.alpha -= 0.015; // Fade out bubble
if (bubble.alpha <= 0) {
bubble.destroy();
lavaBubbles.splice(i, 1);
}
@@ -811,14 +811,10 @@
function adjustScore(averageMulti) {
var points = Math.floor(averageMulti * SCORE_SEGMENT_POINTS);
score = Math.max(0, score + points);
scoreText.setText(String(score).padStart(6, '0'));
- distanceText.setText((distanceRemaining -= SCORE_SEGMENT_DISTANCE) + 'm');
+ distanceText.setText((distanceRun += SCORE_SEGMENT_DISTANCE) + 'm');
incrementText.setText((points === SCORE_MAX_POINTS ? '[MAX!] +' : '+') + points);
- if (distanceRemaining <= 0) {
- body.pushAnimation(animationStand, PLAYER_SPEED_DECREMENT / speedFactor);
- callGameOver();
- }
}
;
body.pushAnimation(animationRun, PLAYER_POSE_TRANSITION);
});
@@ -871,8 +867,9 @@
self.destroy();
}
} else if (!self.taken && player.body.torso.intersects(self)) {
self.taken = true;
+ kgCollected += 0.01; // Add 0.01 to kgCollected
var globalPosition = self.parent.toGlobal(self.position);
self.parent.removeChild(self);
game.addChild(self);
self.position = game.toLocal(globalPosition);
@@ -914,8 +911,9 @@
self.destroy();
}
} else if (!self.taken && player.body.torso.intersects(self)) {
self.taken = true;
+ kgCollected += 0.01; // Add 0.01 to kgCollected
var globalPosition = self.parent.toGlobal(self.position);
self.parent.removeChild(self);
game.addChild(self);
self.position = game.toLocal(globalPosition);
@@ -1112,8 +1110,10 @@
var score = 0;
var winningTime = 0;
var gameOver = false;
var distanceRemaining = SCORE_TOTAL_DISTANCE;
+var distanceRun = 0;
+var kgCollected = 0;
;
var startY = 0; // Variable to store the initial Y position for swipe detection
var swipeStarted = false; // Flag to start detecting swipe only after tap
// Instances
@@ -1142,15 +1142,15 @@
x: road.x,
y: road.y,
scale: 0.5
}));
-var distanceText = game.addChild(new BorderedText(distanceRemaining + 'm', {
+var distanceText = game.addChild(new BorderedText(distanceRun + 'm', {
x: road.x,
y: road.y - TEXT_DEFAULT_SIZE,
anchorX: 0.5,
anchorY: 1
}));
-var scoreText = game.addChild(new BorderedText('000000', {
+var scoreText = game.addChild(new BorderedText('0000.00', {
x: road.x,
y: road.y,
size: TEXT_DEFAULT_SIZE * 1.5,
anchorX: 0.5,
white
circle sliced into many pieces, flat image. 2d, white background, shadowless.
pixel art of a tall, tree. game asset, 2d, white background, shadowless.
pixel art cloud. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
dark space.
flying lava bubble. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a bonus crystal ball with the recycle symbol. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
top view A green round start button empty in the center like a ring.