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
@@ -120,8 +120,9 @@
self.update = function () {
if (self.isOnGround && !self.isFalling) {
self.leftLeg.height = 200;
self.leftArm.height = 200;
+ self.trunk.rotation = 0.125;
self.runAnim();
}
if (!self.isOnGround && !self.isFalling) {
//log("self.leftArm.height", self.leftArm.height);
@@ -136,10 +137,10 @@
self.isOnGround = true;
}
}
if (self.isFalling) {
- self.y += 10; //self.speedY;
- //self.speedY += self.gravity;
+ self.y += 10 / 2; // Divide by 2 when falling
+ //self.speedY += self.gravity / 2; // Optionally adjust gravity effect if needed
var groundY = game.groundLevel + 100;
if (self.y >= groundY) {
self.y = groundY;
self.isOnGround = true;
@@ -179,9 +180,9 @@
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);
+ self.trunk.rotation = 0.333; //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;
@@ -289,10 +290,10 @@
// Method to update track position
self.update = function () {
self.x += self.speedX;
// Reset position to create a continuous track effect
- if (self.x <= -2048) {
- self.x = 2048;
+ if (self.x <= -2048 - self.speedX * 2) {
+ self.x = 2048 + self.speedX * 2;
}
};
});
@@ -305,12 +306,12 @@
/****
* Game Code
****/
-// Enumeration for game states
/****************************************************************************************** */
/************************************** GLOBAL VARIABLES ********************************** */
/****************************************************************************************** */
+// Enumeration for game states
var GAME_STATE = {
INIT: 'INIT',
MENU: 'MENU',
HELP: 'HELP',
@@ -327,11 +328,12 @@
var obstacleSpawnRate = 180; // Spawn an obstacle every 2 seconds
var isDebug = true;
var track;
var track2;
+var track3;
var scoreTxt;
var globalSpeed = -10; //-10; // Global speed for tracks and obstacles min = -4
-var globalSpeedIncreaseStep = 0;
+var globalSpeedIncreaseStep = 5;
/****************************************************************************************** */
/************************************** POSTURES ****************************************** */
/****************************************************************************************** */
var idlePosture = {
@@ -407,8 +409,13 @@
// Second track instance for continuous effect
track2 = game.addChild(new Track());
track2.x = 2048; // Position the second track right after the first one
track2.y = 2732 - 512;
+ // Second track instance for continuous effect
+ track3 = game.addChild(new Track());
+ track3.x = 2048 * 2; // Position the second track right after the first one
+ track3.y = 2732 - 512;
+ track3.visible = false;
// Initialize athlete
athlete = game.addChild(new Athlete());
athlete.x = 400;
athlete.y = groundLevel - 200;
@@ -453,8 +460,9 @@
}
if (!(athlete.isFalling && athlete.isOnGround)) {
track.update();
track2.update();
+ track3.update();
} else {
// Stop obstacles movement when athlete is falling and on ground
obstacles.forEach(function (obstacle) {
obstacle.speedX = 0;
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.