Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: isFalling is not defined' in or related to this line: 'obstacleSpawnTicker += isFalling ? 0 : 1;' Line Number: 474
Code edit (11 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: fallSpeed is not defined' in or related to this line: 'self.rightArm.rotation += (Math.PI / 2 - self.rightArm.rotation) * fallSpeed;' Line Number: 245
Code edit (1 edits merged)
Please save this source code
User prompt
add obstaclesLine2
User prompt
add a second line of obstacles
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: track4 is not defined' in or related to this line: 'track4.update();' Line Number: 458
User prompt
make the new tracks move like the previous one
User prompt
add other tracks above current tracks
Code edit (17 edits merged)
Please save this source code
User prompt
add a debugMarker to the game
Code edit (1 edits merged)
Please save this source code
User prompt
separate gamePlaying code in functions
Code edit (1 edits merged)
Please save this source code
Code edit (22 edits merged)
Please save this source code
User prompt
divide globalspeed by when falling
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Don’t Count a point when falling
Code edit (1 edits merged)
Please save this source code
User prompt
Update score text
Code edit (15 edits merged)
Please save this source code
User prompt
Add a text2 at top center for the score
===================================================================
--- original.js
+++ change.js
@@ -90,8 +90,9 @@
}
if (self.targetPosture && self.targetPosture.head) {
self.head.x += (self.targetPosture.head.x - self.head.x) * speed;
}
+ self.trunk.rotation += (self.targetPosture.trunk.r - self.trunk.rotation) * speed;
self.head.y += (self.targetPosture.head.y - self.head.y) * speed;
self.rightArm.x += (self.targetPosture.rightArm.x - self.rightArm.x) * speed;
self.rightArm.y += (self.targetPosture.rightArm.y - self.rightArm.y) * speed;
self.rightArm.rotation += (self.targetPosture.rightArm.r - self.rightArm.rotation) * speed;
@@ -219,8 +220,23 @@
// Set new posture
self.targetPosture = newPosture;
}
};
+ self.restore = function () {
+ log("restore...");
+ self.x = 400;
+ self.y = groundLevel - 200;
+ self.setPosture(idlePosture);
+ self.isFalling = false;
+ self.isOnGround = true;
+ self.hasFlashed = false;
+ self.hasFlashedGround = false;
+ self.trunk.rotation = 0;
+ self.rightArm.rotation += (Math.PI / 2 - self.rightArm.rotation) * fallSpeed;
+ self.leftArm.rotation += (Math.PI / 2 - self.leftArm.rotation) * fallSpeed;
+ self.rightLeg.rotation += (Math.PI / 2 - self.rightLeg.rotation) * fallSpeed;
+ self.leftLeg.rotation += (Math.PI / 2 - self.leftLeg.rotation) * fallSpeed;
+ };
});
/****************************************************************************************** */
/************************************** OBSTACLE CLASS ************************************ */
/****************************************************************************************** */
@@ -308,8 +324,9 @@
var track3;
var track4;
var scoreTxt;
var globalSpeed = -10; //-10; // Global speed for tracks and obstacles min = -4
+var fallSpeed = 0.1; // Define fallSpeed in the global scope
var globalSpeedIncreaseStep = 5;
var isDebug = true;
var debugMarker;
/****************************************************************************************** */
@@ -318,9 +335,10 @@
var idlePosture = {
name: "idlePosture",
trunk: {
x: 0,
- y: 0
+ y: 0,
+ r: 0.125
},
head: {
x: 0,
y: 0
@@ -453,10 +471,10 @@
obstacles.push(newObstacle);
game.addChild(newObstacle);
// Line 2
var newObstacle2 = new Obstacle(obstaclesLine2.length);
- newObstacle2.x = 2048; // Start from the right edge
- newObstacle2.y = groundLevel + 200;
+ newObstacle2.x = 2048 + 100; // Start from the right edge
+ newObstacle2.y = groundLevel + 200 - 220;
obstaclesLine2.push(newObstacle2);
game.addChild(newObstacle2);
}
}
@@ -512,9 +530,11 @@
LK.effects.flashScreen(0xff0000, 500); // Flash screen red for half a second
athlete.hasFlashedGround = true;
globalSpeed = 0;
LK.setTimeout(function () {
- LK.showGameOver(); // Show game over screen
+ //LK.showGameOver(); // Show game over screen
+ athlete.restore();
+ globalSpeed = -10;
}, 1000); // Delay game over to allow fall animation to be seen
}
}
/****************************************************************************************** */
Elongated elipse with black top half and white bottom half.
full close and front view of empty stands. retro gaming style
delete
delete
Basquettes à ressort futuriste. vue de profile. Retro gaming style
a blue iron man style armor flying. Retro gaming style
a blue iron man style armor flying horizontally. Retro gaming style
round button with a big "up" arrow icon and a small line under it. UI
A big black horizontal arrow pointing left with centred text 'YOU' in capital letters, painted on an orange floor.. horizontal and pointing left
remove
gold athletics medal with ribbon. retro gaming style
a black oval with a crying smiley face.