User prompt
Double size of hitpounta
User prompt
Hitpont colos should be black
User prompt
Move hitpont to center of enemy
User prompt
If fairy collides with enemy then explode faify into particles and game over
Code edit (1 edits merged)
Please save this source code
User prompt
Improve game perfirmance
User prompt
Make sure blocka are 4 per row
User prompt
Make sure blocks are only 5 per row
User prompt
Increase coins speed
User prompt
Reduce rhe ammoun of nlocks
User prompt
Add particle effect whhen a block esplodes
User prompt
Improve game performnace
User prompt
Always keep shadows behind main image
User prompt
Reduce ghost images quantoity in half
User prompt
Do not move the fairy when toucjing sceen to that position butstart moving it from that point like kittne force
User prompt
make ghost image less intense
User prompt
add a ghost image of the fairy when it moves
User prompt
if fairy is moving to the right use mirror image
User prompt
add shirking and expanding effet to fairy sideways to feel movement
User prompt
after boss is killed, pause game and offer player to buy upgrades using coins
User prompt
create a config file to define how many waves each level will have
User prompt
when a boss is destroyed, a new level should start. if there is no level configured, just replay previous level
User prompt
boss should stay on the top 30 % of the screen and have lateral movement
Code edit (2 edits merged)
Please save this source code
User prompt
make sure coins or powerups only spawn in the positon of the destroyed block
===================================================================
--- original.js
+++ change.js
@@ -131,8 +131,20 @@
self.x = Math.random() * 2048;
}
};
});
+// UpgradeMenu class
+var UpgradeMenu = Container.expand(function () {
+ var self = Container.call(this);
+ var menuGraphics = self.attachAsset('menu', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.visible = false; // Initially hidden
+ self.update = function () {
+ // Update menu items
+ };
+});
/****
* Initialize Game
****/
@@ -144,9 +156,8 @@
* Game Code
****/
// Function to start a new level or replay the previous level
function startNewLevel() {
- currentLevel = (currentLevel + 1) % levelConfig.length; // Move to the next level or loop back to the first level
waveCount = 0; // Reset wave count
score = 0; // Reset score
scoreTxt.setText(score); // Update score text
coinCount = 0; // Reset coin count
@@ -161,8 +172,10 @@
bullets.splice(j, 1);
}
// Reinitialize game elements
initGame();
+ LK.resumeGame(); // Resume the game
+ upgradeMenu.visible = false; // Hide the upgrade menu
}
// Initialize variables
var fairy;
var bullets = [];
@@ -173,36 +186,23 @@
var coinCount = 0; // Initialize coin counter
var coinCounterTxt; // Declare coinCounterTxt variable
var isFairyHeld = false; // Track if the fairy is being held
var waveCount = 0; // Track the wave count
-var levelConfig = [{
- waves: [{
- enemies: 6,
- hitpoints: [1]
- }, {
- enemies: 12,
- hitpoints: [2, 1]
- }, {
- enemies: 18,
- hitpoints: [3, 2, 1]
- }]
+var waveConfig = [{
+ enemies: 6,
+ hitpoints: [1]
}, {
- waves: [{
- enemies: 8,
- hitpoints: [1]
- }, {
- enemies: 16,
- hitpoints: [2, 1]
- }, {
- enemies: 24,
- hitpoints: [3, 2, 1]
- }]
+ enemies: 12,
+ hitpoints: [2, 1]
+}, {
+ enemies: 18,
+ hitpoints: [3, 2, 1]
}
-// Add more levels as needed
+// Add more wave configurations as needed
];
// Initialize game elements
function initGame() {
- currentLevel = 0; // Initialize the current level
+ // Create and position the fairy
fairy = game.addChild(new Fairy());
fairy.x = 2048 / 2;
fairy.y = 2732 - 200;
// Create score text
@@ -315,9 +315,10 @@
game.addChild(newPowerup);
}
// Check if the destroyed enemy is the boss
if (enemies[l] instanceof Boss) {
- startNewLevel();
+ LK.pauseGame(); // Pause the game
+ upgradeMenu.visible = true; // Show the upgrade menu
}
}
break;
}
@@ -334,10 +335,10 @@
}
// Spawn new enemies in a line
if (LK.ticks % 600 == 0) {
waveCount++;
- if (waveCount < levelConfig[currentLevel].waves.length) {
- var currentWave = levelConfig[currentLevel].waves[waveCount];
+ if (waveCount <= waveConfig.length) {
+ var currentWave = waveConfig[waveCount - 1];
var maxEnemiesPerLine = 6;
var enemySpacing = 2048 / (maxEnemiesPerLine + 1); // Adjust spacing to center enemies
var totalRows = Math.ceil(currentWave.enemies / maxEnemiesPerLine);
for (var i = 0; i < currentWave.enemies; i++) {
@@ -367,5 +368,9 @@
}
}
}
// Initialize the game
-initGame();
\ No newline at end of file
+initGame();
+// Create and position the upgrade menu
+var upgradeMenu = game.addChild(new UpgradeMenu());
+upgradeMenu.x = 2048 / 2;
+upgradeMenu.y = 2732 / 2;
\ No newline at end of file
8-bit. cartoon. white star.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon 8 bit fairy dust. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cartoon, 8bit, fireball. Black border. Cicular.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon, 8 bit, shield. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8bit, cartoon, axe. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
dark electric ball, 8bit, cartoon.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8bit, cartoon, treasure chest frame. very big empty center. only a fine border of chest. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
shoot
Sound effect
boom
Sound effect
Hit
Sound effect
backgroundmusic
Sound effect
bossbullet
Sound effect
bossappear
Sound effect
hit
Sound effect
diamondcollect
Sound effect
hooray
Sound effect
nono
Sound effect
letsgo
Sound effect
death
Sound effect
yes
Sound effect