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
Code edit (1 edits merged)
Please save this source code
Code edit (11 edits merged)
Please save this source code
User prompt
in gamePlayingDown when "// Make the athlete run" animate the button width and height to simulate a button press
Code edit (1 edits merged)
Please save this source code
Code edit (13 edits merged)
Please save this source code
User prompt
add a 'down' handler for runbutton
Code edit (1 edits merged)
Please save this source code
User prompt
I didn't say to remove the previous button!
User prompt
in initMenuState, add two semi-transparent runButtons in the upper half of the screen
Code edit (20 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: difficulty is not defined' in or related to this line: 'self.nextHurdleSpeedX = -1 * Math.min(0, 2 - difficulty) + (-5 + 10 * Math.random() * (1 + 0.5 * (difficulty - 1))); // Level n' Line Number: 216
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: 'ReferenceError: bonusGraphics is not defined' in or related to this line: 'bonusGraphics.visible = false;' Line Number: 502
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: BonusManager is not defined' in or related to this line: 'bonusManager = new BonusManager();' Line Number: 1041
Code edit (4 edits merged)
Please save this source code
User prompt
add a new class Bonus
Code edit (10 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -688,9 +688,9 @@
anchorX: 0.1,
anchorY: 1.0,
y: 100
});
- /*
+ /*
self.flag = self.attachAsset('finishFlag', {
anchorX: 0.5,
anchorY: 0.0,
x: 580,
@@ -702,21 +702,19 @@
self.speedX = globalSpeedPerLine[0];
self.x += self.speedX;
};
self.cut = function () {
- var cutHeight = 50; // Amount to reduce the height each frame
- var cutDuration = 5000; // Duration of the cut in milliseconds
- var cutRate = cutDuration / (60 * (self.centralRodRight.height / cutHeight)); // Calculate how often to cut based on 60 FPS and total height
- var cutCounter = 0;
+ var cutHeight = 30;
var cutInterval = LK.setInterval(function () {
- if (cutCounter < cutRate) {
- self.centralRodRight.height -= cutHeight;
- self.centralRodLeft.height -= cutHeight;
- cutCounter++;
+ if (self.centralRodRight.height > 0) {
+ var newHeight = Math.max(0, self.centralRodRight.height - cutHeight);
+ self.centralRodRight.height = newHeight;
+ self.centralRodLeft.height = newHeight;
} else {
LK.clearInterval(cutInterval);
}
- }, 1500 / 60); // Execute at roughly 60 FPS
+ }, 25);
+ finishLine.isCut = true;
};
});
/****************************************************************************************** */
/************************************** OBSTACLE CLASS ************************************ */
@@ -850,15 +848,16 @@
var scoreTxt;
var drone;
var bonusManager;
var currentFinishPosition = 1;
-var difficultyLevel = 1;
-var droneEnrtyObstacleNumber = 5;
-var droneStaySeconds = 3;
-var globalBaseSpeed = -20 - 10 * difficultyLevel;
+var difficultyLevel = 2;
+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 isDebug = true;
var debugMarker;
// UI
@@ -971,9 +970,9 @@
function gameMenuDown(x, y, obj) {
log("gameMenuDown...");
cleanMenuState();
initHurdlesStartingState();
- finishLine.cut(); // TEMP DEBUG !!!
+ LK.gameover();
}
function hurdlesStartingPlayingDown(x, y, obj) {
cleanHurdlesStartingState();
initPlayingState();
@@ -999,8 +998,17 @@
}
} else {
log("gamePlayingDown : raceFinishTime : " + raceFinishTime + " => " + (Date.now() - raceFinishTime));
if (Date.now() - raceFinishTime > 1000) {
+ // Increase difficulty if the athlete has won the race
+ if (athlete.finishPosition == 1) {
+ difficultyLevel++;
+ globalBaseSpeed = -20 - 5 * difficultyLevel;
+ if (difficultyLevel > 3) {
+ // TODO SWITCH TO SCORE STATE
+ LK.gameover();
+ }
+ }
// Return to menu
cleanPlayingHurdlesState();
initMenuState();
}
@@ -1022,8 +1030,15 @@
y: -256,
visible: true
});
game.addChild(background);
+ var fieldBackground = LK.getAsset('fieldBackground', {
+ anchorX: 0.0,
+ anchorY: 0.0,
+ x: 0,
+ y: 898
+ });
+ game.addChild(fieldBackground);
field = LK.getAsset('field', {
anchorX: 0.0,
anchorY: 0.0,
x: -50,
@@ -1113,13 +1128,8 @@
startText.x = 2048 / 2; // Center horizontally
startText.y = 2732 / 2; // Center vertically
game.addChild(startText);
gameState = GAME_STATE.MENU;
- // TEMP DEBUG
- finishLine = new FinishLine();
- finishLine.x = 2048 - 1024;
- finishLine.y = groundLevel + 200;
- game.addChild(finishLine);
}
function menuHandling() {
if (drone) {
drone._update_migrated();
@@ -1201,9 +1211,8 @@
}
if (drone) {
drone._update_migrated();
}
- finishLine._update_migrated(); // TEMP DEBUG
}
// PLAYING HURDLES
function initPlayingState() {
scoreTxt = new Text2("0/" + numberOfObstacles.toString(), {
@@ -1223,8 +1232,9 @@
drone = new DeliveryDrone(); // false for odd drone graphic
drone.prepare();
bonusManager.endBonus();
game.addChild(drone);
+ raceStartTime = Date.now();
gameState = GAME_STATE.PLAYING;
}
function cleanPlayingHurdlesState() {
// Remove Opponents & Athlete
@@ -1277,37 +1287,39 @@
/****************************************************************************************** */
function updateFields() {
if (!(athlete.isFalling && athlete.isOnGround)) {
field.x += globalSpeedPerLine[0];
+ var offset = 20;
+ //log("Field Decalage :" + globalSpeedPerLine[0]);
// Reset position to create a continuous effect
- if (field.x <= -2048 - 50) {
- field.x = 2048 + 50;
+ if (field.x <= -2048 - offset) {
+ field.x = 2048 + offset;
}
fieldOdd.x += globalSpeedPerLine[0];
// Reset position to create a continuous effect
- if (fieldOdd.x <= -2048 - 50) {
- fieldOdd.x = 2048 + 50;
+ if (fieldOdd.x <= -2048 - offset) {
+ fieldOdd.x = 2048 + offset;
}
// Far field
farField.x += globalSpeedPerLine[0] * 0.8;
// Reset position to create a continuous effect
- if (farField.x <= -2048 - 50) {
- farField.x = 2048 + 50;
+ if (farField.x <= -2048 - offset) {
+ farField.x = 2048 + offset;
}
farFieldOdd.x += globalSpeedPerLine[0] * 0.8;
// Reset position to create a continuous effect
- if (farFieldOdd.x <= -2048 - 50) {
- farFieldOdd.x = 2048 + 50;
+ if (farFieldOdd.x <= -2048 - offset) {
+ farFieldOdd.x = 2048 + offset;
}
stadium.x += globalSpeedPerLine[0] * 0.4;
// Reset position to create a continuous effect
- if (stadium.x <= -2048 - 50) {
- stadium.x = 2048 + 50;
+ if (stadium.x <= -2048 - offset) {
+ stadium.x = 2048 + offset;
}
stadiumOdd.x += globalSpeedPerLine[0] * 0.4;
// Reset position to create a continuous effect
- if (stadiumOdd.x <= -2048 - 50) {
- stadiumOdd.x = 2048 + 50;
+ if (stadiumOdd.x <= -2048 - offset) {
+ stadiumOdd.x = 2048 + offset;
}
}
}
function spawnObstacles() {
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.