Code edit (1 edits merged)
Please save this source code
User prompt
in menuHandling use ticks instead of setInterval
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: game.getChildByName is not a function' in or related to this line: 'var drone = game.getChildByName('drone');' Line Number: 925
User prompt
in menuHandling, alternate visibility of the drones
Code edit (2 edits merged)
Please save this source code
User prompt
in initMenuState , use drone class
Code edit (6 edits merged)
Please save this source code
User prompt
create a new Drone class
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
in checkForCollisions, the setTimeout uses the iterator line, this can cause unwanted behaviour, secrure this part of the code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: opponents[(line - 1)] is undefined' in or related to this line: 'opponents[line - 1].isRunning = true;' Line Number: 1217
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: blocker is not defined' in or related to this line: 'if (blocker) {' Line Number: 1111
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: opponents[(line - 1)] is undefined' in or related to this line: 'opponents[line - 1].isRunning = true;' Line Number: 1210
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: opponents[(line - 1)] is undefined' in or related to this line: 'log("Line " + line + " : opponent " + opponents[line - 1].lineIndex + " Restore after block");' Line Number: 1207
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: opponents[(line - 1)] is undefined' in or related to this line: 'opponents[line - 1].isRunning = true;' Line Number: 1203
Code edit (17 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: opponent is not defined' in or related to this line: 'opponent.restore();' Line Number: 1202
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -559,12 +559,12 @@
/****
* Game Code
****/
+// Enumeration for game states
/****************************************************************************************** */
/************************************** GLOBAL VARIABLES ********************************** */
/****************************************************************************************** */
-// Enumeration for game states
var GAME_STATE = {
INIT: 'INIT',
MENU: 'MENU',
HELP: 'HELP',
@@ -855,10 +855,11 @@
startText.anchor.set(0.5, 0.5); // Center the text horizontally and vertically
startText.x = 2048 / 2; // Center horizontally
startText.y = 2732 / 2; // Center vertically
game.addChild(startText);
- blocker = new Blocker(600, groundLevel - 200 - 220 * 1);
- game.addChild(blocker);
+ // TEMP DEBUG TEST BLOCKER
+ //blocker = new Blocker(-1024, groundLevel - 200 - 475 * 1);
+ //game.addChild(blocker);
gameState = GAME_STATE.MENU;
}
function cleanMenuState() {
game.removeChild(startText);
@@ -1047,9 +1048,10 @@
finishLine = new FinishLine();
finishLine.x = 2048 * obstacleSpawnDistanceRate * (numberOfObstacles + 1) + 1024; // Start from the right edge
finishLine.y = groundLevel + 200;
game.addChild(finishLine);
- blocker = new Blocker(startX, linesGroundLevels[1]);
+ // Spawn Blocker
+ blocker = new Blocker(startX + 2048, linesGroundLevels[1] - 675);
game.addChild(blocker);
}
function updateObstacles() {
// Update obstacles
@@ -1167,8 +1169,18 @@
log("Line " + line + " : opponent " + opponents[line - 1].lineIndex + " collided with obstacle " + obstacle.lineIndex);
opponents[line - 1].isFalling = true;
opponents[line - 1].isOnGround = false;
}
+ if (opponents[line - 1].isRunning && opponents[line - 1].intersects(blocker)) {
+ LK.effects.flashScreen(0xff0000, 500); // Flash screen red for half a second
+ opponents[line - 1].isRunning = false;
+ LK.setTimeout(function () {
+ globalSpeedPerLine[line - 1] = globalBaseSpeed;
+ opponents.forEach(function (opponent) {
+ opponent.restore();
+ });
+ }, 2000); // Delay game over to allow fall animation to be seen
+ }
}
}
}
handleFallEvent();
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.