User prompt
for powerup checck on tick if shield is colliding with powerup. if not set self.collidingWithShield = false.
Code edit (1 edits merged)
Please save this source code
User prompt
if shield stops colliding wiht powerup allow bubble sound to be played again
User prompt
when shield touches powerup play bubble sound
User prompt
play bubble sound every time the shield touches the powerup. once per touch thought.
User prompt
make sure powerup does not keep playing bubble sound if still touching
User prompt
play again bubble sound if shield touches powerup again
User prompt
play bubble sound when shield touches powerup
User prompt
play bubble sound when shield touches the powerup. have same behaviour as with obstacles
User prompt
when shield stops touching powerup make sure buble plays again if it touches it again
User prompt
make sure flag also resets when shield stops touching powerup
User prompt
add bubbble sound whne shield intersects with powerup too
User prompt
when obstacles stop touching shield they should keep their original x speed
User prompt
make sure resetting collidingwitshield flag is being set to false correctly
User prompt
when shield is not collidign twith any obstacle set collidingwithshield to false
User prompt
play bubble sound again if obstacle is touched again
User prompt
if shield touches obstacle, stops and then touches it again you can play bubble sound again
User prompt
make sure bubble sound is not conituosly played if shield keeps touching the current obstacle
User prompt
every time the shield touches and obstacle play bubble sound, but do not play it again if shield is still touching that obstacle
User prompt
when shield is blinking play shieldoff
User prompt
remove bubble sound
User prompt
play bubble sound when bubble hits a obstacle. do not play it again until bubble stops colisioning that obstacle and collision a new one or that same one
User prompt
if bubble is touching obstacle do nto keep playing bubble sound. only play it again once bubble is not touch and obstacle ad touches one again
User prompt
only play bubble sound when you first touch an obstcale
User prompt
add a very very small sideways movement to obstacle 5
===================================================================
--- original.js
+++ change.js
@@ -143,8 +143,9 @@
scaleY: 0.7
});
// Set obstacle1 speed
self.speed = -5;
+ self.originalSpeedX = self.speed;
// This is automatically called every game tick, if the obstacle1 is attached!
self.update = function () {
// Rotate obstacle1 on its axis
self.rotation += 0.05;
@@ -167,8 +168,9 @@
self.x += dx * 5;
self.y += dy * 5;
} else {
self.collidingWithShield = false;
+ self.speed = self.originalSpeedX;
}
// Check for collision with diver
if (self.intersects(diver.children.find(function (child) {
return child.alpha === 0;
@@ -244,8 +246,9 @@
scaleY: 0.7
});
// Set obstacle2 speed
self.speed = -5;
+ 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
if (self.intersects(shield, {
@@ -266,8 +269,9 @@
self.x += dx * 5;
self.y += dy * 5;
} else {
self.collidingWithShield = false;
+ self.speed = self.originalSpeedX;
}
// Check for collision with diver
if (self.intersects(diver.children.find(function (child) {
return child.alpha === 0;
@@ -344,8 +348,9 @@
scaleY: 0.7
});
// Set obstacle3 speed
self.speed = -5;
+ 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
if (self.intersects(shield, {
@@ -366,8 +371,9 @@
self.x += dx * 5;
self.y += dy * 5;
} else {
self.collidingWithShield = false;
+ self.speed = self.originalSpeedX;
}
// Check for collision with diver
if (self.intersects(diver.children.find(function (child) {
return child.alpha === 0;
@@ -444,8 +450,9 @@
scaleY: 0.7
});
// Set obstacle4 speed
self.speed = -5;
+ self.originalSpeedX = self.speed;
// This is automatically called every game tick, if the obstacle4 is attached!
self.update = function () {
// Add up and down movement
self.y += Math.sin(LK.ticks / 20) * 2;
@@ -468,8 +475,9 @@
self.x += dx * 5;
self.y += dy * 5;
} else {
self.collidingWithShield = false;
+ self.speed = self.originalSpeedX;
}
// Check for collision with diver
if (self.intersects(diver.children.find(function (child) {
return child.alpha === 0;
@@ -545,8 +553,9 @@
scaleY: 0.7
});
// Set obstacle5 speed
self.speed = -5;
+ self.originalSpeedX = self.speed;
// This is automatically called every game tick, if the obstacle5 is attached!
self.update = function () {
// Add very small sideways movement
self.x += Math.sin(LK.ticks / 100) * 0.5;
@@ -569,8 +578,9 @@
self.x += dx * 5;
self.y += dy * 5;
} else {
self.collidingWithShield = false;
+ self.speed = self.originalSpeedX;
}
// Check for collision with diver
if (self.intersects(diver.children.find(function (child) {
return child.alpha === 0;
@@ -647,8 +657,9 @@
scaleY: 0.7
});
// Set obstacle6 speed
self.speed = -5;
+ self.originalSpeedX = self.speed;
// This is automatically called every game tick, if the obstacle6 is attached!
self.update = function () {
// Flickering effect
self.alpha = Math.random() * 0.5 + 0.5; // Random alpha between 0.5 and 1
@@ -673,8 +684,9 @@
self.x += dx * 5;
self.y += dy * 5;
} else {
self.collidingWithShield = false;
+ self.speed = self.originalSpeedX;
}
// Check for collision with diver
if (self.intersects(diver.children.find(function (child) {
return child.alpha === 0;
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.