Code edit (1 edits merged)
Please save this source code
User prompt
ensure that there is alwas a objdash generated before there is an objspikey
Code edit (10 edits merged)
Please save this source code
User prompt
ensure at least one objjump is generated when the avoid event begins
Code edit (5 edits merged)
Please save this source code
User prompt
add a console.log when the objevent is being destroyed
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: fase is not defined' in or related to this line: 'var objSpikeyIncrease1 = fase;' Line Number: 1324
Code edit (1 edits merged)
Please save this source code
User prompt
allow to have 2 objspikey to be on the screen at the same time
Code edit (3 edits merged)
Please save this source code
User prompt
ensure that function destroyspikey destroys all instances of objspikey
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: spikeys.length is not a function' in or related to this line: 'for (var i = 0; i < spikeys.length(); i++) {' Line Number: 1287
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: spikeys.length is not a function' in or related to this line: 'for (var i = 0; i < spikeys.length(); i++) {' Line Number: 1287
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
ad a second objspikey at traveleddistance 1000 and a third objspikey once traveleddistance has reached 3000
Code edit (9 edits merged)
Please save this source code
User prompt
ensure objNightFilter is above the city when being added to the game
Code edit (6 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'destroy')' in or related to this line: 'objNightFilter.destroy();' Line Number: 2030
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -69,8 +69,12 @@
if (self.alpha <= 0) {
LK.clearInterval(self.fadeOutInterval);
self.visible = false;
randomEvent = ""; // Reset random event
+ //adjust the event counter as an event has been completed
+ if (eventCounter > 0) {
+ eventCounter--;
+ }
eventTxt.setText('Event: None'); // Update event text
isEventOngoing = false; // Set event status to false
LK.getSound('snd_powerup').play(); // Play snd_powerup sound
LK.getSound('snd_nice').play(); // Play snd_nice sound
@@ -132,9 +136,8 @@
}, 16); // Approximately 60 FPS
};
self.attackPatternA = function () {
// Define Attack Pattern A behavior here
- console.log("Executing Attack Pattern A");
// Instantiate objwindup in the center of the enemy
objWindup = LK.getAsset('objwindup', {
anchorX: 0.5,
anchorY: 0.5
@@ -177,9 +180,8 @@
}, 3000);
}, 2000);
};
self.attackPatternB = function () {
- console.log("Executing Attack Pattern B");
var duration = 12000; // 12 seconds
var interval = 3000; // 3 seconds
var startTime = Date.now();
var spawnSphere = function spawnSphere() {
@@ -700,8 +702,12 @@
isEventOngoing = false;
eventTxt.setText('Event: None');
randomEvent = "";
distanceTraveled += 100;
+ //adjust the event counter as an event has been completed
+ if (eventCounter > 0) {
+ eventCounter--;
+ }
// Trigger acceleration effects
LK.getSound('snd_powerup').play(); // Play snd_powerup sound
LK.getSound('snd_nice').play(); // Play snd_nice sound
destroyAllObjs(); // Destroy all instances of ObjGO, ObjRALLY, and ObjJUMP
@@ -1171,8 +1177,9 @@
collectTimerTxt.y = 100;
var collectTimer = 20.0;
var collectTimerInterval;
var randomEvent = "";
+var eventCounter = randomIntFromInterval(1, 3);
var catchTimer = 15.0;
var catchTimerTxt = new Text2(catchTimer.toString(), {
size: 75,
fill: "#ffcccb",
@@ -1205,9 +1212,8 @@
}, 500 + Math.random() * 2000);
};
var generateObjSPIKEY = function generateObjSPIKEY() {
var lenSpikey = obstacles.filter(function (obstacle) {
- console.log(obstacle instanceof ObjSPIKEY);
return obstacle instanceof ObjSPIKEY;
}).length;
if (distanceTraveled < 500) {
if (lenSpikey >= 1) {
@@ -1255,8 +1261,9 @@
var explosion = new ParticleExplosion(obstacles[i].x, obstacles[i].y);
game.addChild(explosion);
obstacles[i].destroy();
obstacles.splice(i, 1);
+ LK.getSound('snd_spikey').play();
}
}
}
}
@@ -1313,12 +1320,10 @@
};
// Function to handle collision and update the counter
function handleCollisionWithObj() {
collisionCounter += 1;
- console.log("handleCollisionWithObj called, collisionCounter:", collisionCounter);
if (collisionCounter >= 1) {
destroyAllObjs();
- isEventOngoing = true;
}
}
function generateObjData() {
LK.setTimeout(function () {
@@ -1355,9 +1360,9 @@
}
var generateObjJUMP = function generateObjJUMP() {
if (obstacles.filter(function (obstacle) {
return obstacle instanceof ObjJUMP;
- }).length >= 2) {
+ }).length >= 1) {
return;
}
// Add delay to avoid two ObjJUMP spawning on top of each other
// Removed minimum delay of 60 ticks for ObjGO spawning
@@ -1669,19 +1674,16 @@
if (obstacles[i] instanceof ObjDrone || obstacles[i] instanceof ObjCar) {
obstacles[i].update();
}
if (obstacles[i] instanceof ObjEvents && heroGround.intersects(obstacles[i])) {
- console.log("heroGround intersected with ObjEvents at position:", {
- x: obstacles[i].x,
- y: obstacles[i].y
- });
var explosion = new ParticleExplosion(obstacles[i].x, obstacles[i].y);
game.addChild(explosion);
LK.getSound('snd_walkie').play(); // Play snd_walkie sound
obstacles[i].destroy();
obstacles.splice(i, 1);
handleCollisionWithObj();
destroySpikeys();
+ isEventOngoing = true;
// Ensure event text is displayed
var eventsNight = ['Catch', 'Survive'];
var eventsDay = ['Avoid', 'Collect'];
//get a random number between 0 and 1 to get the index randomly selected.
@@ -1696,9 +1698,8 @@
randomEvent = eventsDay[indexEvent];
}
//set the event text once an event type has been selected.
eventTxt.setText('Event: ' + randomEvent);
- console.log("Random event selected:", randomEvent);
if (randomEvent === 'Collect') {
collectTimer = 20;
var checkObjDataActive = LK.setInterval(function () {
if (objDataArray.length > 0) {
@@ -1749,8 +1750,10 @@
LK.clearInterval(checkObjDataActiveForCounter);
}
}, 100);
} else if (randomEvent === 'Avoid') {
+ // Ensure at least one objjump is generated when the avoid event begins
+ generateObjJUMP();
// Instantiate objcarsign in the center of the playspace
var objCarSign = LK.getAsset('objcarsign', {
anchorX: 0.5,
anchorY: 0.5
@@ -1925,24 +1928,26 @@
objDataArray[j]._move_migrated();
}
if (hero.intersects(objDataArray[j]) || heroGround.intersects(objDataArray[j])) {
objDataCounter += 1;
- console.log("ObjData collected, objDataCounter:", objDataCounter);
collectCounterTxt.setText(objDataCounter.toString() + "/10");
LK.getSound('snd_dataacquire').play(); // Play snd_dataacquire sound
objDataArray[j].destroy();
objDataArray.splice(j, 1);
if (objDataCounter >= 10) {
LK.clearInterval(collectTimerInterval);
game.removeChild(collectTimerTxt);
- console.log("Collect event completed");
isEventOngoing = false;
objDataCounter = 0;
collectCounterTxt.setText(objDataCounter.toString() + "/10");
game.removeChild(collectCounterTxt);
eventTxt.setText('Event: None');
randomEvent = "";
distanceTraveled += 100; // Add 100 to the distance
+ //adjust the event counter as an event has been completed
+ if (eventCounter > 0) {
+ eventCounter--;
+ }
// Trigger acceleration effects
LK.getSound('snd_powerup').play(); // Play snd_powerup sound
LK.getSound('snd_nice').play(); // Play snd_nice sound
destroyAllObjs(); // Destroy all instances of ObjGO, ObjRALLY, and ObjJUMP
@@ -2016,12 +2021,14 @@
if (distanceTraveled < 100) {
if (objNightFilter) {
objNightFilter.destroy();
}
- } else if (distanceTraveled > 100) {
- lastNightFilterDistance = Math.floor(distanceTraveled / 100);
- //if the number is not even, add the night filter
- if (lastNightFilterDistance % 2 != 0 && !objNightFilter) {
+ } else {
+ //we check if the event counter is 0;
+ //if we have reached 0 and there is no night filter we want to add the night filter and reset the counter
+ //that way for the next switch we will be able to have the number to decrease until we get to the day time.
+ if (eventCounter <= 0 && !objNightFilter) {
+ eventCounter = randomIntFromInterval(1, 3);
objNightFilter = LK.getAsset('objnightfilter', {
anchorX: 0.5,
anchorY: 0.5
});
@@ -2029,10 +2036,12 @@
objNightFilter.x = game.width / 2;
objNightFilter.y = game.height / 2;
game.addChildAt(objNightFilter, game.getChildIndex(parallaxCity) + 1); // Ensure objNightFilter is above objcity
}
- //else it means it is even, we remove the nightfilter
- else if (lastNightFilterDistance % 2 == 0 && objNightFilter) {
+ //here we reset the event counter and we remove the night filter
+ //that way the new counter for the next event decrease is going to be there.
+ else if (eventCounter <= 0 && objNightFilter) {
+ eventCounter = randomIntFromInterval(1, 3);
objNightFilter.destroy();
}
}
//adjusting the distance that is being traveled.
@@ -2113,8 +2122,12 @@
};
var animationSpeed = 2; // Define animationSpeed in the global scope
var enemyMiddleRight;
var enemySpawnedCount = 0;
+function randomIntFromInterval(min, max) {
+ // min and max included
+ return Math.floor(Math.random() * (max - min + 1) + min);
+}
function selectAndAnimateEnemy() {
if (eventTxt && eventTxt.text && eventTxt.text.includes('Survive')) {
if (enemySpawnedCount === 0) {
enemyMiddleRight = new EnemyMiddleRight();
@@ -2148,8 +2161,12 @@
isEventOngoing = false;
eventTxt.setText('Event: None');
randomEvent = "";
distanceTraveled += 100;
+ //adjust the event counter as an event has been completed
+ if (eventCounter > 0) {
+ eventCounter--;
+ }
LK.getSound('snd_powerup').play();
LK.getSound('snd_nice').play();
destroyAllObjs(); //destroy the power ups
destroySpikeys(); //destroy the spikeys
2d cyberpunk particle of a dash ability. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
blue jetfuel. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art speech bubble that says "?" neon color. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art speech bubble that says "Go" neon color. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art speech bubble that says "Ok" neon color.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a bubble a wing inside in neon color.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art bubble with 2 fast foward arrows neon color. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Gray Cyber neon lit logo of the word Rush. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
side profile of a flying car in the art style of a 16 bit neon cyberpunk game. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
retro cyberpunk datadisk in neon colors. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
retro cyberpunk pole flag in neon colors with the words 'events' on it.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
retro sign that says "Hold to Dash" in neon colors. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
retro sign that says "Tap to Move" in neon colors.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
retro sign that says "catch" with an flying drone symbol in neon colors.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
retro flying drone in neon colors.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
retro sign that says "Survive" with an face symbol in neon colors... Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
neon colored cyberpunk round electricity. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
SynthwaveMusic
Music
snd_letsgo
Sound effect
snd_announcer
Sound effect
snd_powerup
Sound effect
snd_dataacquire
Sound effect
snd_walkie
Sound effect
snd_nice
Sound effect
snd_carhonk
Sound effect
snd_enemy
Sound effect
snd_sphere
Sound effect
snd_windup
Sound effect
snd_spikey
Sound effect
snd_drone
Sound effect