Code edit (17 edits merged)
Please save this source code
User prompt
on tap on the DeliveryDrone, make the packet1 fall to the ground
Code edit (1 edits merged)
Please save this source code
User prompt
inside DeliveryDrone class, create 2 drone instances
User prompt
Create a class DeliveryDrone, put inside 2 drone instances and their visbility logic
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
===================================================================
--- original.js
+++ change.js
@@ -561,12 +561,12 @@
/****
* Game Code
****/
-// Enumeration for game states
/****************************************************************************************** */
/************************************** GLOBAL VARIABLES ********************************** */
/****************************************************************************************** */
+// Enumeration for game states
var GAME_STATE = {
INIT: 'INIT',
MENU: 'MENU',
HELP: 'HELP',
@@ -587,9 +587,9 @@
var obstacleSpawnTicker = 0;
var obstacleSpawnDistanceRate = 1.5; // Ratio of screen width between obstacles
var obstacleJustPassed = false;
var startingBlocks = [];
-var blocker;
+var blockers = [];
var startX = 600;
var aiJumpLeftLimit = -350;
var aiJumpRightLimit = 2048 + 512;
var finishLine;
@@ -858,9 +858,9 @@
startText.x = 2048 / 2; // Center horizontally
startText.y = 2732 / 2; // Center vertically
game.addChild(startText);
// TEMP DEBUG TEST BLOCKER
- //blocker = new Blocker(-1024, groundLevel - 200 - 475 * 1);
+ //var blocker = new Blocker(-1024, groundLevel - 200 - 475 * 1);
//game.addChild(blocker);
gameState = GAME_STATE.MENU;
}
function cleanMenuState() {
@@ -1050,11 +1050,15 @@
finishLine = new FinishLine();
finishLine.x = 2048 * obstacleSpawnDistanceRate * (numberOfObstacles + 1) + 1024; // Start from the right edge
finishLine.y = groundLevel + 200;
game.addChild(finishLine);
- // Spawn Blocker
- blocker = new Blocker(startX + 2048, linesGroundLevels[1] - 675);
- game.addChild(blocker);
+ // Spawn Blockers
+ for (var line = 1; line < numberOfLines; line++) {
+ if (line == 3) {
+ blockers[line] = new Blocker(startX + 2048, linesGroundLevels[1] - 675); // TODO : Fic index 1
+ game.addChild(blockers[line]);
+ }
+ }
}
function updateObstacles() {
// Update obstacles
for (var line = 0; line < numberOfLines; line++) {
@@ -1139,9 +1143,9 @@
for (var line = 1; line < numberOfLines; line++) {
if (line == 1) {
log("Check finish for #3 at x=" + opponents[line - 1].x + " vs " + (finishLine.x + 512));
}
- if (opponents[line - 1] && opponents[line - 1].x > finishLine.x + 512 && opponents[line - 1].isRunning) {
+ if (opponents[line - 1].x > finishLine.x + 512 && opponents[line - 1].isRunning) {
if (line == 1) {
log("OK #3 Passed the line !");
}
// stop opponents at finish
@@ -1171,9 +1175,10 @@
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].head.intersects(blocker)) {
+ if (blockers[line] && opponents[line - 1].isRunning && opponents[line - 1].head.intersects(blockers[line])) {
+ var blocker = blockers[line];
log("Line " + line + " : opponent " + opponents[line - 1].lineIndex + " collided with Blocker ", blocker);
LK.effects.flashScreen(0xff0000, 500); // Flash screen red for half a second
opponents[line - 1].isRunning = false;
opponents[line - 1].isBlocked = true;
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.