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
User prompt
Add 1 to score for each hurdle passed
User prompt
In Athlete update() Jumpspeed and gravity should grow with globalSpeed
User prompt
Jumpspeed and gravity should grow with globalSpeed
Code edit (1 edits merged)
Please save this source code
User prompt
In gamePlaying after the first flash on collision , add a second flash when athlete reache the ground ( isOnGround==true)
User prompt
after the first flash on collision , add a second flash when athlete reache s the ground ( isOnGround==true)
User prompt
Add a second flash when isFalling and isOnGround
User prompt
Add an additional one time flash when isFalling and isOnGround
User prompt
Add another one time flash when isFalling and isOnGround
Code edit (1 edits merged)
Please save this source code
User prompt
Reduce jump speed as global speed increases
===================================================================
--- 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.