User prompt
the current Parabolic trajectory isn't parabolic, please make update like this: - from detritus x to Math.abs((target.x-x)/2 make them move up (reduce y) a bit - from detritus Math.abs((target.x-x)/2 to target.x make them move down (increase y to reach target.y) with acceleration
User prompt
make current move of taken detritus a parabolic trajectory (first move up then down)
User prompt
it doesn't work, currently detritus move to the top at high speed and never fall back to the recycle bin check if the signs are correct.
Code edit (10 edits merged)
Please save this source code
User prompt
now use advanced calculations in order to make the taken detritus move with natural physics from their position to the target (parabolic trajectory)
Code edit (5 edits merged)
Please save this source code
User prompt
stop bgMusic in callGameover
User prompt
when start button is pressed play bgMusic after 100ms
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
in StartButton, also animate recycle alpha from 1 to 0 and vice versa
Code edit (4 edits merged)
Please save this source code
User prompt
in StartButton, animate recycle rotation
Code edit (3 edits merged)
Please save this source code
User prompt
add a start button class using the current 3 startXXX assets and instanciate it after the recycle bin.
User prompt
add a global isStarted = false; then don't update Road and Player if isStarting is false;
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -866,10 +866,15 @@
var dx = targetX - self.x;
var dy = targetY - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > speed) {
- self.x += dx / distance * speed;
- self.y += dy / distance * speed - 0.5 * Math.sin((self.x - targetX) / 100); // Parabolic trajectory
+ if (Math.abs(self.x - targetX) > Math.abs(dx / 2)) {
+ self.x += dx / distance * speed;
+ self.y -= speed / 2; // Move up
+ } else {
+ self.x += dx / distance * speed;
+ self.y += speed / 2; // Move down with acceleration
+ }
self.scale.x *= 0.998;
self.scale.y *= 0.998;
} else {
self.x = targetX;
@@ -910,10 +915,15 @@
var dx = targetX - self.x;
var dy = targetY - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > speed) {
- self.x += dx / distance * speed;
- self.y += dy / distance * speed - 0.5 * Math.sin((self.x - targetX) / 100); // Parabolic trajectory
+ if (Math.abs(self.x - targetX) > Math.abs(dx / 2)) {
+ self.x += dx / distance * speed;
+ self.y -= speed / 2; // Move up
+ } else {
+ self.x += dx / distance * speed;
+ self.y += speed / 2; // Move down with acceleration
+ }
self.scale.x *= 0.9975;
self.scale.y *= 0.9975;
} else {
self.x = targetX;
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.