User prompt
obstacle 3 shouldd be slowly spining on its axis
Code edit (1 edits merged)
Please save this source code
User prompt
shapes can randomly have up to 100% more space between each grid element. but each wave will have the same spacing between its elements.
User prompt
shapes can randomly have up to 100% more space between each grid element
Code edit (2 edits merged)
Please save this source code
User prompt
bubbles tint should also get darker like background
User prompt
when a new wave is spawned, the obstacles x speed should not impact the previous obstacles x speed. they should be independent on each wave.
User prompt
when buubble moves sideways it should also move extra to the side the obstacle is movig
User prompt
increase a little bubble speed
User prompt
bubbles should also cahnge their y speed when obstacles change it
User prompt
when an obstacles is created create a temporary variable with their y original speed that will not be updated when a new wave is spawned
User prompt
change bubbles y speed the same way obstacles do
User prompt
bubbles should have the same y speed as obstacles
User prompt
each obstacle wave should keep their original obstacle.y speed independent from a new wave spawning with a new y speed
User prompt
when a new waveof obstacles is created, do not change the speed x of the obstacles already on the screen
Code edit (1 edits merged)
Please save this source code
User prompt
also increase the frequency whne a wave is spawned as the game gets harder
User prompt
obstacle should keep the x speed of when its created and not change (unless touched by shield or other obstacle)
User prompt
on tick check self.x speed of obstacle, and if not being touched by shield or repelled by other obstacle go back to its original speed
Code edit (1 edits merged)
Please save this source code
User prompt
on tick, make obstacle go back to their original x direciton
User prompt
when repulsion force is not applied anymore, make sure obstacles go back to their original x speed
User prompt
make sure obstacles do not change their x speed in any other part of the game other than the start and when shield or other obstacle moves them
User prompt
shieldoff should only play once
===================================================================
--- original.js
+++ change.js
@@ -43,9 +43,9 @@
self.colliding = false;
// This is automatically called every game tick, if the bubble is attached!
self.update = function () {
// Move the bubble upwards and sideways
- self.y += self.speed * speedMultiplier;
+ self.y += self.speed;
self.x += Math.sin(LK.ticks / 10) * 0.1;
// Reset the position of the bubble when it reaches the top
if (self.y <= 0) {
self.y = 2732;
@@ -144,8 +144,9 @@
scaleY: 0.7
});
// Set obstacle1 speed
self.speed = -5;
+ self.originalSpeedY = self.speed; // Store original speed
self.originalSpeedX = self.speed;
// This is automatically called every game tick, if the obstacle1 is attached!
self.update = function () {
// Rotate obstacle1 on its axis
@@ -169,9 +170,9 @@
self.x += dx * 5;
self.y += dy * 5;
} else {
self.collidingWithShield = false;
- self.speed = self.originalSpeedY;
+ self.speed = self.originalSpeedX;
}
// Check for collision with diver
if (self.intersects(diver.children.find(function (child) {
return child.alpha === 0;
@@ -247,8 +248,9 @@
scaleY: 0.7
});
// Set obstacle2 speed
self.speed = -5;
+ self.originalSpeedY = self.speed; // Store original speed
self.originalSpeedX = self.speed;
// This is automatically called every game tick, if the obstacle2 is attached!
self.update = function () {
// Check if the obstacle is colliding with the shield
@@ -270,9 +272,9 @@
self.x += dx * 5;
self.y += dy * 5;
} else {
self.collidingWithShield = false;
- self.speed = self.originalSpeedY;
+ self.speed = self.originalSpeedX;
}
// Check for collision with diver
if (self.intersects(diver.children.find(function (child) {
return child.alpha === 0;
@@ -349,8 +351,9 @@
scaleY: 0.7
});
// Set obstacle3 speed
self.speed = -5;
+ self.originalSpeedY = self.speed; // Store original speed
self.originalSpeedX = self.speed;
// This is automatically called every game tick, if the obstacle3 is attached!
self.update = function () {
// Check if the obstacle is colliding with the shield
@@ -372,9 +375,9 @@
self.x += dx * 5;
self.y += dy * 5;
} else {
self.collidingWithShield = false;
- self.speed = self.originalSpeedY;
+ self.speed = self.originalSpeedX;
}
// Check for collision with diver
if (self.intersects(diver.children.find(function (child) {
return child.alpha === 0;
@@ -451,8 +454,9 @@
scaleY: 0.7
});
// Set obstacle4 speed
self.speed = -5;
+ self.originalSpeedY = self.speed; // Store original speed
self.originalSpeedX = self.speed;
// This is automatically called every game tick, if the obstacle4 is attached!
self.update = function () {
// Add up and down movement
@@ -476,9 +480,9 @@
self.x += dx * 5;
self.y += dy * 5;
} else {
self.collidingWithShield = false;
- self.speed = self.originalSpeedY;
+ self.speed = self.originalSpeedX;
}
// Check for collision with diver
if (self.intersects(diver.children.find(function (child) {
return child.alpha === 0;
@@ -554,8 +558,9 @@
scaleY: 0.7
});
// Set obstacle5 speed
self.speed = -5;
+ self.originalSpeedY = self.speed; // Store original speed
self.originalSpeedX = self.speed;
// This is automatically called every game tick, if the obstacle5 is attached!
self.update = function () {
// Add very small sideways movement
@@ -579,9 +584,9 @@
self.x += dx * 5;
self.y += dy * 5;
} else {
self.collidingWithShield = false;
- self.speed = self.originalSpeedY;
+ self.speed = self.originalSpeedX;
}
// Check for collision with diver
if (self.intersects(diver.children.find(function (child) {
return child.alpha === 0;
@@ -658,8 +663,9 @@
scaleY: 0.7
});
// Set obstacle6 speed
self.speed = -5;
+ self.originalSpeedY = self.speed; // Store original speed
self.originalSpeedX = self.speed;
// This is automatically called every game tick, if the obstacle6 is attached!
self.update = function () {
// Flickering effect
@@ -685,9 +691,9 @@
self.x += dx * 5;
self.y += dy * 5;
} else {
self.collidingWithShield = false;
- self.speed = self.originalSpeedY;
+ self.speed = self.originalSpeedX;
}
// Check for collision with diver
if (self.intersects(diver.children.find(function (child) {
return child.alpha === 0;
@@ -1046,16 +1052,12 @@
console.log('Wave starting position:', wavePositionLabel);
console.log('Wave starting position:', wavePositionLabel);
layoutPositions.forEach(function (position) {
var obstacle = game.addChild(new obstacleType());
+ // Position the obstacles according to the layout, using the grid for positioning
obstacle.x = randomStartX + (position.x - gridSize / 2) * cellSize;
obstacle.y = 2732 + position.y * cellSize; // Spawn obstacles offscreen at the bottom
- obstacle.originalSpeedX = obstacle.speed; // Ensure the original speed x is set
- obstacle.originalSpeedY = obstacle.speed; // Ensure the original speed y is set
obstacles.push(obstacle);
- bubbles.forEach(function (bubble) {
- bubble.speed = obstacle.speed; // Ensure bubbles' y speed changes the same way obstacles do
- });
});
currentWave++;
if (currentWave >= obstacleLayouts.length) {
allWavesSpawnedOnce = true;
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.