Code edit (1 edits merged)
Please save this source code
Code edit (6 edits merged)
Please save this source code
User prompt
add a Text2 in the Billboard class
Code edit (4 edits merged)
Please save this source code
User prompt
add a Billboard class
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: jumpButtonHelpText is undefined' in or related to this line: 'jumpButtonHelpText.visible = true;' Line Number: 1686
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
implement setRoundColors use a random color for the tint except the 1st color '0x1188FF' which is fixed for the player (line 0)
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: athlete is undefined' in or related to this line: 'usedColors.push(opponents[i] ? opponents[i].tint : athlete.tint);' Line Number: 1624
Code edit (3 edits merged)
Please save this source code
User prompt
in getRunnerColor, ensure that runners don't get the same color
Code edit (1 edits merged)
Please save this source code
User prompt
in Athlete class, use a random color for the tint except the 1st color '0x1188FF' which is fixed for the player (line 0)
User prompt
add more unique colors to the colorsArray
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: LK.gameover is not a function' in or related to this line: 'LK.gameover();' Line Number: 1008
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -29,8 +29,9 @@
self.nextPosture = null;
self.tint = colorsArray[self.lineIndex % colorsArray.length];
self.previousX = 0;
self.justTookBonus = false;
+ self.isWaiting = true; // Player at speed 0
self.nbJumps = 0;
// BODY PARTS
self.trunk = self.attachAsset('bodyPart', {
anchorX: 0.5,
@@ -226,10 +227,19 @@
if (self.isOnGround) {
// Running
self.leftLeg.height = 200;
self.leftArm.height = 200;
- self.trunk.rotation = 0.125;
- self.runAnim();
+ if (globalSpeedPerLine[0] != 0) {
+ self.isWaiting = false;
+ self.trunk.rotation = 0.125;
+ self.runAnim();
+ } else {
+ if (!self.isWaiting) {
+ self.isWaiting = true;
+ self.trunk.rotation = 0.0;
+ self.setPosture(idlePosture);
+ }
+ }
} else {
// Jumping
self.speedY += self.gravity * 2;
self.y += self.speedY * 2;
@@ -242,8 +252,20 @@
log("Restore previous Speed..." + self.speedBeforeBonus);
globalSpeedPerLine[self.lineIndex] = self.speedBeforeBonus;
self.speedBeforeBonus = 0;
}
+ // Restore pos
+ if (globalSpeedPerLine[0] != 0) {
+ self.isWaiting = false;
+ self.trunk.rotation = 0.125;
+ self.runAnim();
+ } else {
+ if (!self.isWaiting) {
+ self.isWaiting = true;
+ self.trunk.rotation = 0.0;
+ self.setPosture(idlePosture);
+ }
+ }
} else {
if (self.justTookBonus) {
log("Apply Bonus Speed...");
if (!self.speedBeforeBonus) {
@@ -252,9 +274,8 @@
}
globalSpeedPerLine[self.lineIndex] = self.speedBeforeBonus * 2;
}
self.jumpAnim();
- self.runAnim();
}
}
// Update athlete speed
if (self.isOnGround && !finishLine.isCut && Date.now() - lastRunTime > 1000) {
@@ -336,37 +357,44 @@
self.jumpAnim = function () {
if (self.lineIndex == 1) {
//log("Check finish for #3 at x=" + opponents[line - 1].x + " vs " + (finishLine.x + 512));
}
- var ocsilDelay = 50;
+ var ocsilDelay = 5;
var armsAmplitude = 1;
- // Simulate running by continuously balancing the arms and legs
var runningArmAngle = Math.sin(LK.ticks / ocsilDelay) * armsAmplitude; // Oscillate arm angle to simulate running faster
- var armSwitchProgress = (Math.sin(LK.ticks / 5) + 0) / 2; // Normalize between 0 and 1
+ var armSwitchProgress = Math.sin(LK.ticks / 5) * 0.5; // Normalize between 0 and 1
self.rightArm.x = 10 * (1 - armSwitchProgress) - 5 * armSwitchProgress;
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.333; //armSwitchProgress; // + 10 * Math.abs(runningArmAngle);
- var rotationSpeed = 0.05; // Speed of rotation change
+ //self.trunk.width = 30 - 10 * (runningArmAngle * Math.PI * 0.5);
+ self.trunk.rotation = 0.333;
+ var rotationSpeed = 0.001; //0.05; // Speed of rotation change
if (self.speedY > 0) {
- self.rightArm.rotation += (0 - self.rightArm.rotation) * rotationSpeed % (Math.PI * 2);
- self.leftArm.rotation += (0 - self.leftArm.rotation) * rotationSpeed % (Math.PI * 2);
+ var rr = self.rightArm.rotation - self.rightArm.rotation * rotationSpeed; // % (Math.PI * 2);
+ self.rightArm.rotation = rr;
+ var lr = self.leftArm.rotation - self.leftArm.rotation * rotationSpeed; // % (Math.PI * 2);
+ self.leftArm.rotation = lr;
+ //self.rightArm.rotation += (0 - self.rightArm.rotation) * rotationSpeed % (Math.PI * 2);
+ //self.leftArm.rotation += (0 - self.leftArm.rotation) * rotationSpeed % (Math.PI * 2);
// 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 -= 30 * rotationSpeed;
self.leftArm.height -= 20 * rotationSpeed;
} else {
//log("self.rightArm.rotation=" + self.rightArm.rotation, " + " + -Math.PI * 3 * rotationSpeed % (Math.PI * 2));
- self.rightArm.rotation += -Math.PI * 3 * rotationSpeed % (Math.PI * 2);
- self.leftArm.rotation += Math.PI * 1.75 * rotationSpeed % (Math.PI * 2);
+ var rr = -Math.PI * 0.5; //self.rightArm.rotation - Math.PI * 3 * rotationSpeed; // % (Math.PI * 2);
+ self.rightArm.rotation = rr;
+ var lr = Math.PI * 0.2; //self.leftArm.rotation + Math.PI * 1.75 * rotationSpeed; // % (Math.PI * 2);
+ self.leftArm.rotation = lr;
+ //self.rightArm.rotation += -Math.PI * 3 * rotationSpeed % (Math.PI * 2);
+ //self.leftArm.rotation += Math.PI * 1.75 * rotationSpeed % (Math.PI * 2);
// Continue with jump animation adjustments
- self.rightLeg.rotation += -0.55 - self.rightLeg.rotation * rotationSpeed;
- self.leftLeg.rotation += (1 - self.leftLeg.rotation) * rotationSpeed;
- self.leftLeg.height -= 0 * rotationSpeed;
- self.leftArm.height -= 35 * rotationSpeed;
+ self.rightLeg.rotation = -Math.PI * 0.6; //+= -0.55 - self.rightLeg.rotation * rotationSpeed;
+ self.leftLeg.rotation = Math.PI * 0.2; //+= (1 - self.leftLeg.rotation) * rotationSpeed;
+ //self.leftLeg.height -= 0 * rotationSpeed;
+ //self.leftArm.height -= 35 * rotationSpeed;
}
};
self.fallAnim = function () {
if (self.lineIndex == 1) {
@@ -825,9 +853,9 @@
var numberOfOpponents = 3; // Adjust based on the actual number of opponents in the game
var groundLevel = 2732 - 200; // Ground level set 200px from the bottom
var linesGroundLevels = []; // Ground level set 200px from the bottom
var numberOfLines = 1 + numberOfOpponents;
-var numberOfObstacles = 2; //20; // Total number of hurdles
+var numberOfObstacles = 20; // Total number of hurdles
var obstacles = [[]];
var obstacleSpawnTicker = 0;
var obstacleSpawnDistanceRate = 1.5; // Ratio of screen width between obstacles
var obstacleJustPassed = false;
@@ -848,17 +876,17 @@
var scoreTxt;
var drone;
var bonusManager;
var currentFinishPosition = 1;
-var difficultyLevel = 2;
+var difficultyLevel = 1;
var globalBaseSpeed = -20 - 5 * difficultyLevel;
var globalSpeedPerLine = []; // Global speed for tracks and obstacles default -10 / min = -4
var speedGauge = 0;
var raceFinishTime = 0;
var raceStartTime = 0;
var droneEnrtyObstacleNumber = 5;
var droneStaySeconds = 3;
-var colorsArray = [0x1188FF, 0xFF0000, 0x00FF00, 0xFFFF00, 0xFF00FF, 0x00FFFF, 0xFFFFFF, 0xFF8811];
+var colorsArray = [0x1188FF, 0xFF0000, 0x00FF00, 0xFFFF00, 0xFF00FF, 0x00FFFF, 0xFFFFFF, 0xFF8811, 0x7F00FF, 0xFF007F, 0x7FFF00, 0x00FF7F, 0x007FFF];
var isDebug = true;
var debugMarker;
// UI
var startText;
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.