User prompt
make red flash longer when killed
Code edit (1 edits merged)
Please save this source code
User prompt
also play killed_1 after accident_1
User prompt
play accident_1 when killed
User prompt
when setting killer[2] active, play ambulance_1
User prompt
when setting killer[1] active, play police_1
User prompt
when setting killer[0] active, play car_1
Code edit (4 edits merged)
Please save this source code
User prompt
play levelWin_1 when wining a level
User prompt
add a function playHit() thay randmoly plays hit_1, hit_2 or hit_3
User prompt
play hit_1 when hitting an obstacle
User prompt
stop bgMusic when player is killed
User prompt
play coin_1 when player collects a coin
User prompt
play bgMusic repeatedly after start button press
User prompt
Please fix the bug: 'ReferenceError: currentTime is not defined' in or related to this line: 'self.lastKillerUpdate = currentTime;' Line Number: 425
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'resetKillers')' in or related to this line: 'killerManager.resetKillers();' Line Number: 1452
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'resetKillers')' in or related to this line: 'killerManager.resetKillers();' Line Number: 1451
Code edit (1 edits merged)
Please save this source code
User prompt
create a KillerManager class to organize killers to activate killers[0] after killerDelay, then killers[1] after killerDelay, then killers[2] after killerDelay, then killers[0] after killerDelay, ....
User prompt
organize killers to activate killers[0] after killerDelay, then killers[1] after killerDelay, then killers[2] after killerDelay, then killers[0] after killerDelay, ....
User prompt
create 3 different killers instead of 1
User prompt
add an index to Killer constructor that allow asset selection
User prompt
create a global array for killers
Code edit (3 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -1048,11 +1048,14 @@
self.interactive = true;
self.buttonMode = true;
self.on('down', function () {
self.visible = false;
- isPlaying = true;
- scoreTxt.visible = true;
updateGoalForLevel(1); // Call updateGoalForLevel(1) when start button is pressed
+ LK.setTimeout(function () {
+ goalText.visible = false;
+ scoreTxt.visible = true;
+ isPlaying = true;
+ }, goalAnnounceDelay);
});
});
var Stripe = Container.expand(function () {
var self = Container.call(this);
@@ -1120,9 +1123,9 @@
goalText.setText('COLLECT\r\n$10');
} else if (level === 2) {
goalText.setText('COLLECT\r\n$100');
} else if (level === 3) {
- goalText.setText('COLLECT\r\n$1 000 000');
+ goalText.setText('COLLECT\r\n$1 000 000+');
}
goalText.visible = true;
LK.setTimeout(function () {
goalText.visible = false;
@@ -1137,33 +1140,35 @@
var levelConfigs = [{}, {
name: "Level 1",
backgroundTint: 0xeda716,
coinValue: 0.10,
- baseSpeed: 10
+ baseSpeed: 10,
+ nextLevelScore: 10
}, {
name: "Level 2",
backgroundTint: 0x2faf1d,
coinValue: 1,
- baseSpeed: 15
+ baseSpeed: 15,
+ nextLevelScore: 100
}, {
name: "Level 3",
backgroundTint: 0x6c6060,
coinValue: 100,
- baseSpeed: 20
+ baseSpeed: 20,
+ nextLevelScore: Infinity // Endless Runner ;)
}];
var stripes = [];
var nbDecorations = 10;
var decorations = [];
// Initialize arrays and variables
var currentLevel = 1;
var road = new Road();
-var nextLevelCoinThreshold = 10;
var isPlaying = false;
var isKilled = false;
var killerDelay = 10000; // Delay in milliseconds before updating killer
var lastKillerUpdate = 0; // Timestamp of the last killer update
var currentCoinType = 0;
-var nextCoinTypeThreshold = 100;
+var nextCoinTypeThreshold = 1000;
var isNight = false;
var roadHeight = 2000;
var roadTop = 1000; // ~= road.height/2 - baseY
var background;
@@ -1172,8 +1177,9 @@
var baseNbCoins = 10;
var baseNbObstacles = 10;
var coins = [];
var obstacles = [];
+var killers = [];
var road;
var score = 0;
var scoreTxt;
var goalText;
@@ -1219,9 +1225,9 @@
score += levelConfigs[currentLevel].coinValue || 1;
score = parseFloat(score.toFixed(1));
coinsCollected += 1; // Increment coins collected counter
}
- if (coinsCollected >= nextLevelCoinThreshold * currentLevel) {
+ if (score >= levelConfigs[currentLevel].nextLevelScore) {
changeLevel(currentLevel + 1);
}
// Format score
log("score=", score, " => ", (score * 100).toFixed(0) + "ยข");
@@ -1239,9 +1245,8 @@
log("changeLevel:", newLevel);
newLevel = Math.max(1, Math.min(levelConfigs.length, newLevel));
currentLevel = newLevel;
currentSpeed = levelConfigs[currentLevel].baseSpeed;
- nextLevelCoinThreshold = levelConfigs[currentLevel].coinValue * 10; // Example threshold calculation
console.log("Level changed to:", currentLevel);
// Add a big white flash effect
LK.effects.flashScreen(0xFFFFFF, 1000); // Flash white for 1 second
// Change background tint using levelConfig
@@ -1467,5 +1472,5 @@
isPlaying = false;
}
gameInitialize();
// DEVLOG:
-// Add obstacles assets switch depending on level and a goal text to inform of collect goal
\ No newline at end of file
+// Delay isPlaying when start button pressed
\ No newline at end of file
Directly overhead, plumb view of a beggar heading top (we see his back).. Zenith view, directly overhead, plumb view. NOT PERSPECTIVE! Fantasy theme. Pixel art
a traffic cone. video game sprite
face view of a big start button in the shape of a dollar bill. video game style
a tree. video game style
a black garbage bag. video game style
Dollar bill. Perspective. video game sprite
perspective of a simple snake rolled up on itself.. video game sprite
Ball of dry desert bushes. video game sprite
tractor. high definition video game sprite
street ad billboard with 1 or 2 posts with "Get rich!" on it. high definition video game sprite
a dog sleeping on a street. video game sprite
desert bush. video game sprite
profile view of an empty motorcycle helmet. black with a white vertical central band and another thiner orange band on the center. NOT PERSPECTIVE!. Pixel art high definition
simple red and white magnet. video game style
gold sign with a "X" and a "2". video game style
bgMusic
Music
coin_1
Sound effect
hit_1
Sound effect
hit_2
Sound effect
hit_3
Sound effect
levelWin_1
Sound effect
car_1
Sound effect
police_1
Sound effect
ambulance_1
Sound effect
accident_1
Sound effect
killed_1
Sound effect
jump_1
Sound effect
rip_1
Sound effect
bonus_take
Sound effect
bonus_approaching
Sound effect