Code edit (18 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: athlete.setposition is not a function' in or related to this line: 'athlete.setposition(startingBlockPosture);' Line Number: 874
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
use startingBlocks class in initHurdlesStartingState
User prompt
create a class for startingBlocks
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: athletes is not defined' in or related to this line: 'var startingBlocks = LK.getAsset('startingBlocks', {' Line Number: 826
User prompt
in initHurdlesStartingState add startingblocks to the game
Code edit (10 edits merged)
Please save this source code
User prompt
create a new posture 'startingBlockPosture'
Code edit (1 edits merged)
Please save this source code
Code edit (15 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: opponents[(line - 1)] is undefined' in or related to this line: 'if (!opponents[line - 1].finishPosition && opponents[line - 1].x > finishLine.x) {' Line Number: 897
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
in victoryAnim, clamp the rotations
Code edit (15 edits merged)
Please save this source code
User prompt
implement the victoryAnim
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: opponents[0] is undefined' in or related to this line: 'opponents[0].update();' Line Number: 706
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
Code edit (6 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -190,11 +190,13 @@
}
}
} else {
if (self.lineIndex == 1) {
- log("WAITING / x=" + self.x + " / y=" + self.y + " / globalSpeedPerLine[0]=" + globalSpeedPerLine[0]);
- log("rightArm len=" + self.rightArm.height);
+ //log("WAITING / x=" + self.x + " / y=" + self.y + " / globalSpeedPerLine[0]=" + globalSpeedPerLine[0]);
}
+ if (self.finishPosition == 1) {
+ self.victoryAnim();
+ }
nextX += -1 * globalSpeedPerLine[0];
}
// Update athlete position
self.x = nextX;
@@ -235,8 +237,11 @@
self.speedY = 0;
self.y = linesGroundLevels[self.lineIndex] + 200;
}
}
+ if (self.finishPosition == 1) {
+ self.victoryAnim();
+ }
}
self.updatePosture();
};
self.jump = function () {
@@ -511,9 +516,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 = 1; //20; //20; // Total number of hurdles
+var numberOfObstacles = 10; //20; // Total number of hurdles
var obstacles = [[]];
var obstacleSpawnTicker = 0;
var obstacleSpawnDistanceRate = 1.5; // Ratio of screen width between obstacles
var obstacleJustPassed = false;
@@ -530,9 +535,9 @@
var track2;
var track3;
var track4;
var scoreTxt;
-var currentFinishPosition = 0;
+var currentFinishPosition = 1;
var globalBaseSpeed = -20;
var globalSpeedPerLine = []; // Global speed for tracks and obstacles default -10 / min = -4
var difficultyLevel = 1; // TODO : Move to global
var colorsArray = [0x1188FF, 0xFF0000, 0x00FF00, 0xFFFF00, 0xFF00FF, 0x00FFFF, 0xFFFFFF, 0xFF8811];
@@ -868,15 +873,15 @@
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
}
for (var line = 0; line < numberOfLines; line++) {
- if (line == 0 && !athlete.finishPosition) {
+ if (line == 0 && !athlete.finishPosition && athlete.x > finishLine.x) {
athlete.finishPosition = getFinishPosition();
- log("athlete => #" + athlete.finishPosition);
+ log("Finish athlete => #" + athlete.finishPosition);
}
if (line > 0 && !opponents[line - 1].finishPosition && opponents[line - 1].x > finishLine.x) {
opponents[line - 1].finishPosition = getFinishPosition();
- log("opponent " + line + "=> #" + opponents[line - 1].finishPosition);
+ log("Finish opponent " + line + "=> #" + opponents[line - 1].finishPosition);
}
}
if (finishLine.isCut) {
for (var line = 0; line < numberOfLines; line++) {
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.