Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -373,10 +373,9 @@
self.rightArm.rotation = idlePosture.rightArm.r;
self.leftArm.rotation = 0;
self.rightLeg.rotation = 0;
self.leftLeg.rotation = 0;
- //self.setPosture(idlePosture);
- self.setPosture(startingBlockPosture); // TEMP DEBUG
+ self.setPosture(idlePosture);
self.isFalling = false;
self.isOnGround = true;
};
});
@@ -745,9 +744,10 @@
});
game.addChild(startButton);
startButton.on('down', function () {
cleanMenuState();
- initPlayingState();
+ //initPlayingState();
+ initHurdlesStartingState();
});
// Add Start Text in the center of the screen
startText = new Text2('START', {
size: 200,
@@ -789,13 +789,29 @@
game.addChild(athlete);
// Check for collisions
checkForCollisions();
}
+function hurdlesStarting() {
+ log("hurdlesStarting...");
+ //self.setPosture(startingBlockPosture); // TEMP DEBUG
+}
function cleanMenuState() {
game.removeChild(startText);
game.removeChild(startButton);
}
-function initPlayingState() {
+function initHurdlesStartingState() {
+ // Add starting blocks to each athlete's starting position
+ for (var i = 0; i <= numberOfOpponents; i++) {
+ var startingBlocks = LK.getAsset('startingBlocks', {
+ anchorX: 0.5,
+ anchorY: 1.0,
+ x: athletes[i].x - 100,
+ // Position slightly behind the athlete
+ y: linesGroundLevels[i] + 50 // Adjusted to align with the ground level of each line
+ });
+ game.addChild(startingBlocks);
+ }
+ log("initHurdlesStartingState...");
// Spawn obstacles
spawnObstacles();
// Initialize opponents
for (var i = numberOfOpponents - 1; i >= 0; i--) {
@@ -804,8 +820,23 @@
}
// Initialize athlete
athlete = game.addChild(new Athlete(0));
athlete.restore();
+ gameState = GAME_STATE.STARTING;
+}
+function initPlayingState() {
+ /*
+ // Spawn obstacles
+ spawnObstacles();
+ // Initialize opponents
+ for (var i = numberOfOpponents - 1; i >= 0; i--) {
+ opponents[i] = game.addChild(new Athlete(i + 1));
+ opponents[i].restore();
+ }
+ // Initialize athlete
+ athlete = game.addChild(new Athlete(0));
+ athlete.restore();
+ */
gameState = GAME_STATE.PLAYING;
}
/****************************************************************************************** */
/************************************** GAME FUNCTIONS ************************************ */
@@ -1041,9 +1072,9 @@
case GAME_STATE.MENU:
// Handle menu logic here
break;
case GAME_STATE.STARTING:
- // Handle game starting logic here
+ hurdlesStarting();
break;
case GAME_STATE.PLAYING:
gamePlaying();
break;
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.