Code edit (4 edits merged)
Please save this source code
User prompt
bubble sound can only play once per second
User prompt
on tick checkc if backtounrd music if playing, if not, play
User prompt
play bacgkround music on loop on game start
User prompt
use bubble sound when an obstacles is pushed
User prompt
score should be displayer on game over message
Code edit (2 edits merged)
Please save this source code
User prompt
background alpha overlay should increase very very slwoly
Code edit (3 edits merged)
Please save this source code
User prompt
overlay should make the color of the background darker when alpha is higher
Code edit (2 edits merged)
Please save this source code
User prompt
make overlay black
Code edit (1 edits merged)
Please save this source code
Code edit (9 edits merged)
Please save this source code
User prompt
add a dark blue transparent overlay on top of the backgounrd
User prompt
reef should be one next to the other
User prompt
mirror reef image on right side
User prompt
reef can have differen widths
User prompt
randomly add on the either side of the screen a reef asset
User prompt
add green algae to the background. similar to bubbles but at another speed
User prompt
player bubbles should be releaased in sets of 3 or 5
User prompt
player bubble sould spawn on random time, and also should spawn between 3 and 6 ever ytime
User prompt
player bubbles should spawn from the bottom right of the player
User prompt
bubble release from player should have a different bubble asset
User prompt
every 5 sesconds player will release a bubble that goes upwrds
===================================================================
--- original.js
+++ change.js
@@ -1,30 +1,7 @@
/****
* Classes
****/
-// Algae class
-var Algae = Container.expand(function () {
- var self = Container.call(this);
- var algaeGraphics = self.attachAsset('algae', {
- anchorX: 0.5,
- anchorY: 0.5,
- alpha: 0.5
- });
- var scale = Math.random() * 0.5 + 0.5;
- algaeGraphics.scale.set(scale, scale);
- // Set algae speed
- self.speed = -1;
- // This is automatically called every game tick, if the algae is attached!
- self.update = function () {
- // Move the algae upwards and sideways
- self.y += self.speed;
- self.x += Math.sin(LK.ticks / 20) * 0.1;
- // Reset the position of the algae when it reaches the top
- if (self.y <= 0) {
- self.y = 2732;
- }
- };
-});
// Background class
var Background = Container.expand(function () {
var self = Container.call(this);
var backgroundGraphics = self.attachAsset('background', {
@@ -306,8 +283,22 @@
}
}
};
});
+var Reef = Container.expand(function () {
+ var self = Container.call(this);
+ var reefGraphics = self.attachAsset('reef', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = -2;
+ self.update = function () {
+ self.y += self.speed;
+ if (self.y < -self.height) {
+ self.destroy();
+ }
+ };
+});
// Shield class
var Shield = Container.expand(function () {
var self = Container.call(this);
var shieldGraphics = self.attachAsset('shield', {
@@ -369,17 +360,8 @@
bubble.y = Math.random() * 2732;
bubbles.push(bubble);
game.addChildAt(bubble, game.children.length);
}
-// Create algae after bubbles
-var algaeInstances = [];
-for (var i = 0; i < 20; i++) {
- var algae = new Algae();
- algae.x = Math.random() * 2048;
- algae.y = Math.random() * 2732;
- algaeInstances.push(algae);
- game.addChildAt(algae, game.children.length);
-}
// Spawn the first wave of obstacles
spawnWave();
;
// Initialize score
@@ -472,8 +454,18 @@
obstacle.x = 2048 / 2 + (position.x - gridSize / 2) * cellSize;
obstacle.y = 2732 + position.y * cellSize; // Spawn obstacles offscreen at the bottom
obstacles.push(obstacle);
});
+ // Randomly add reef to either side of the screen
+ if (Math.random() < 0.5) {
+ var reef = game.addChild(new Reef());
+ reef.x = 100; // Left side
+ reef.y = 2732;
+ } else {
+ var reef = game.addChild(new Reef());
+ reef.x = 1948; // Right side
+ reef.y = 2732;
+ }
currentWave++;
if (currentWave >= obstacleLayouts.length) {
currentWave = 0;
}
@@ -487,9 +479,5 @@
var cellSize = 150;
// Call the spawn wave function every 1 second
// Initial call to spawn the first wave
spawnWave();
-;
-// Update algae
-for (var i = 0; i < algaeInstances.length; i++) {
- algaeInstances[i].update();
-}
\ No newline at end of file
+;
\ No newline at end of file
8bit. cartoon. jellyfish.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
empty 8 bit cartoon white circle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon. 8-bit. octopus. colorful.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon. 8-bit. sea urchin. colorful. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon 8bit stingray. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.