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
@@ -118,11 +118,17 @@
}
};
self.update = function () {
if (self.isOnGround && !self.isFalling) {
+ self.leftLeg.height = 200;
+ self.leftArm.height = 200;
self.runAnim();
}
if (!self.isOnGround && !self.isFalling) {
+ //log("self.leftArm.height", self.leftArm.height);
+ self.jumpAnim();
+ }
+ if (!self.isOnGround && !self.isFalling) {
self.y += self.speedY * Math.abs(globalSpeed / 10);
self.speedY += self.gravity * Math.abs(globalSpeed / 10);
var groundY = game.groundLevel - 200;
if (self.y >= groundY) {
@@ -173,29 +179,29 @@
self.leftArm.x = -15 * (1 - armSwitchProgress) + 20 * armSwitchProgress;
self.rightLeg.x = 5 * (1 - armSwitchProgress) - 5 * armSwitchProgress;
self.leftLeg.x = -10 * (1 - armSwitchProgress) + 10 * armSwitchProgress;
self.trunk.width = 30 - 10 * (runningArmAngle * Math.PI * 0.5); //armSwitchProgress; // + 10 * Math.abs(runningArmAngle);
+ self.trunk.rotation = 0.245; //armSwitchProgress; // + 10 * Math.abs(runningArmAngle);
var rotationSpeed = 0.05; // Speed of rotation change
- /*
if (self.speedY > 0) {
self.rightArm.rotation += (0 - self.rightArm.rotation) * rotationSpeed;
self.leftArm.rotation += (0 - self.leftArm.rotation) * rotationSpeed;
// Return legs to initial rotation when descending
self.rightLeg.rotation += (0 - self.rightLeg.rotation) * rotationSpeed;
self.leftLeg.rotation += (0 - self.leftLeg.rotation) * rotationSpeed;
- self.leftLeg.height += 35 * rotationSpeed;
- self.leftArm.height += 35 * rotationSpeed;
+ self.leftLeg.height -= 30 * rotationSpeed;
+ self.leftArm.height -= 20 * rotationSpeed;
} else {
self.rightArm.rotation += -Math.PI * 3 * rotationSpeed;
self.leftArm.rotation += Math.PI * 1.75 * rotationSpeed;
; //+= (1 - self.leftArm.rotation) * rotationSpeed;
// Continue with jump animation adjustments
self.rightLeg.rotation += (-2.3 - self.rightLeg.rotation) * rotationSpeed;
- self.leftLeg.rotation += (1.8 - self.leftLeg.rotation) * rotationSpeed;
- self.leftLeg.height -= 35 * rotationSpeed;
+ self.leftLeg.rotation += (1 - self.leftLeg.rotation) * rotationSpeed;
+ self.leftLeg.height -= 0 * rotationSpeed;
self.leftArm.height -= 35 * rotationSpeed;
}
- */
+ /*
if (self.speedY > 0) {
self.rightArm.rotation += (0 - self.rightArm.rotation) * rotationSpeed;
self.leftArm.rotation += (0 - self.leftArm.rotation) * rotationSpeed;
// Return legs to initial rotation when descending
@@ -205,15 +211,14 @@
self.leftArm.height += 35 * rotationSpeed;
} else {
self.rightArm.rotation += -Math.PI * 3 * rotationSpeed;
self.leftArm.rotation += Math.PI * 1.75 * rotationSpeed;
- ; //+= (1 - self.leftArm.rotation) * rotationSpeed;
- // Continue with jump animation adjustments
- self.rightLeg.rotation += (-2.3 - self.rightLeg.rotation) * rotationSpeed;
+ self.rightLeg.rotation += (2 - self.rightLeg.rotation) * rotationSpeed;
self.leftLeg.rotation += (1.8 - self.leftLeg.rotation) * rotationSpeed;
self.leftLeg.height -= 35 * rotationSpeed;
self.leftArm.height -= 35 * rotationSpeed;
}
+ */
};
self.fallAnim = function () {
var fallSpeed = 0.1; // Speed of fall animation
// Adjust body parts to simulate falling
@@ -323,9 +328,10 @@
var isDebug = true;
var track;
var track2;
var scoreTxt;
-var globalSpeed = -10; // Global speed for tracks and obstacles
+var globalSpeed = -10; //-10; // Global speed for tracks and obstacles min = -4
+var globalSpeedIncreaseStep = 0;
/****************************************************************************************** */
/************************************** POSTURES ****************************************** */
/****************************************************************************************** */
var idlePosture = {
@@ -423,9 +429,9 @@
// Assuming obstacle width is less than 100px
obstacles[i].destroy();
obstacles.splice(i, 1);
// Increase global speed after each obstacle passed and add 1 to score only if not falling
- globalSpeed -= 5; // Increase the speed
+ globalSpeed -= globalSpeedIncreaseStep; // Increase the speed
track.speedX = globalSpeed; // Update track speed
track2.speedX = globalSpeed; // Update track2 speed
LK.setScore(LK.getScore() + 1); // Add 1 to score for each hurdle passed only if not falling
scoreTxt.setText(LK.getScore()); // Update score text with prefix
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.