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
User prompt
coin or powerup should only spawn in the position of the enemy that has last been destroyed
User prompt
coins and powerups can only spawn when an enemy is destroyed from the enemy position
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'newPowerup.x = enemies[l].x;' Line Number: 279
User prompt
boss should have its own asset
User prompt
boss should stay on the top 30% of the screen and have random movement
User prompt
create a level structure. each level will have 5 waves and a boss
User prompt
move coins counter to the top right of the screen
User prompt
do not use coins: text just he icon
Code edit (2 edits merged)
Please save this source code
User prompt
adjust anchor of coin icon to be in the aligned with the middle of the coin count
User prompt
invert positions of coin icon and coin count
User prompt
move coin icon and count to the top right of the screen
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'var coinIcon = game.addChild(LK.getAsset('coin', {' Line Number: 168
User prompt
move coins icon also
User prompt
move coins counter on the same y position as score but to the right
User prompt
use coin icon istead of coins: text
User prompt
align score counter and coins counter
User prompt
remove coin counter and score from gui
User prompt
move coin coutner below score
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
make sure coin counter is displayed on the top right of the screen. adjust anchor so that it set correctly
===================================================================
--- original.js
+++ change.js
@@ -3,28 +3,24 @@
****/
// Boss class
var Boss = Container.expand(function () {
var self = Container.call(this);
- var bossGraphics = self.attachAsset('block', {
+ var bossGraphics = self.attachAsset('boss', {
anchorX: 0.5,
anchorY: 0.5
});
- self.speed = 3;
+ self.speed = 2;
self.hitpoints = 20; // Boss hitpoints
self.update = function () {
- // Random movement in the top 30% of the screen
- self.x += (Math.random() - 0.5) * self.speed;
- self.y += (Math.random() - 0.5) * self.speed;
- self.x = Math.max(Math.min(self.x, 2048), 0);
- self.y = Math.max(Math.min(self.y, 2732 * 0.3), 0);
+ self.y += self.speed;
// Create and update hitpoints display
if (!self.hitpointsDisplay) {
self.hitpointsDisplay = new Text2(self.hitpoints.toString(), {
- size: 50,
+ size: 100,
fill: "#ffffff"
});
self.hitpointsDisplay.anchor.set(0.5, 0);
- self.hitpointsDisplay.y = 60;
+ self.hitpointsDisplay.y = 120;
self.addChild(self.hitpointsDisplay);
} else {
self.hitpointsDisplay.setText(self.hitpoints.toString());
}
@@ -56,8 +52,33 @@
self.destroy();
}
};
});
+// Enemy class
+var Enemy = Container.expand(function () {
+ var self = Container.call(this);
+ var enemyGraphics = self.attachAsset('block', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 3;
+ self.hitpoints = 3; // Add hitpoints to enemies
+ self.update = function () {
+ self.y += self.speed;
+ // Create and update hitpoints display
+ if (!self.hitpointsDisplay) {
+ self.hitpointsDisplay = new Text2(self.hitpoints.toString(), {
+ size: 50,
+ fill: "#ffffff"
+ });
+ self.hitpointsDisplay.anchor.set(0.5, 0);
+ self.hitpointsDisplay.y = 60;
+ self.addChild(self.hitpointsDisplay);
+ } else {
+ self.hitpointsDisplay.setText(self.hitpoints.toString());
+ }
+ };
+});
//<Assets used in the game will automatically appear here>
// Fairy class
var Fairy = Container.expand(function () {
var self = Container.call(this);
@@ -287,8 +308,9 @@
}
} else if (waveCount == waveConfig.length + 1) {
// Spawn boss enemy
var boss = new Boss();
+ boss.hitpoints = 20; // Set boss hitpoints
boss.x = 2048 / 2;
boss.y = -50;
enemies.push(boss);
game.addChild(boss);
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