User prompt
Now i want to flash ninja with red color, when obstacle are interset.
User prompt
Remve the sheild bubble logic and convert the sheild bubble logic to same as dash ( how dash is following the ninja ), but sheild bubble is not always visible, it will be visible when the sheild is intersect with the ninja
User prompt
i think may you missunderstoo, so the logic should be like: when player collects sheild - 1st Thing show the sheild bubble around the ninja ( working ) - 2nd if the ninja is on lower path and it jumps to a upper path then change the location of the sheild bubble to ninja location after ninja changes the path, only if the sheild cooldown time is not over ( which is 10s after collecting the sheild ). And same thing when ninja is on upper path and it jumps to a lower path.
User prompt
i don't know why, but the logic for sheild bubble to change location on jump is not working, find some way to fix the bug or try some new logic to make that happen.
User prompt
still the issue persist, now what we can do instead of previous logic, do the check for bubble on click as i mentioned but when the check is true, destroy the bubble and spawn the new bubble at the ninja location( after ninja change the location ).
User prompt
You can do one thing to fix the issue, whenever player clicks on the screen, check if the sheild bubble is still there ( mean the 10sec sheild timer is not finished ) then move the sheild bubble to inverse path of the current path ( or at the new location of the ninja )
User prompt
Sheild bubble is not updating the location when ninja jumps to another path.
User prompt
Remove the tint logic, instead add the sheild bubble around the ninja, and sheild bubble should move along with ninja, whenever the ninja jumps to other path, after 10s remove the sheild bubble, size of sheild bubble should be bigger than the ninja.
User prompt
Now whenever the sheild intersects with ninja, Change the color or tint of the ninja sprites to blue, and make ninja invincible for 10 sec, also play a sheild collection sound effect. After 10sec reset everything back to normal.
User prompt
Now whenever the sheild intersects with ninja, Change the tint of the ninja for upcoming sprites to blue, and make ninja invincible, also play a sheild collection sound effect.
User prompt
Now add check in lives ( collectible ) with ninja, and when interacted : Add one life in the display life and destroy the spawned life.
User prompt
Speed of Lives spawn should be same as the sheild.
User prompt
Now remove the check for the interaction of ninja with lives from the code.
User prompt
Now add check in sheild for interaction with ninja, and perform the logic of sheild.
User prompt
Remove the check for interaction of ninja with sheild from the code.
User prompt
Please fix the bug: 'ReferenceError: ninjaGraphics is not defined' in or related to this line: 'ninjaGraphics.tint = 0x0000ff; // Change tint to blue' Line Number: 408
User prompt
Use the same collision detection logic as of Coin Container. inside the Sheild Container.
User prompt
Z order of the sheild and lives should be same as coin.
User prompt
Still not working, Check Collision Logic to fix the issue.
User prompt
check for Z-Index and Layering, to fix the issue.
Code edit (1 edits merged)
Please save this source code
User prompt
whenever the ninja collides with sheild print "Sheild" in console.
User prompt
Remove the progress bar logic from sheild
User prompt
No, still ninja is not able to get the sheild. fix this
User prompt
Fix all the bugs and issues.
===================================================================
--- original.js
+++ change.js
@@ -348,8 +348,64 @@
game.setChildIndex(self, game.getChildIndex(ninja) - 1); // Ensure shield is on the same Z order as coin
if (self.x < -self.width) {
self.destroy();
}
+ // Check for intersection with ninja
+ if (self.intersects(ninja)) {
+ var shieldCollected = false;
+ for (var j = 0; j < ninja.runFrames.length; j++) {
+ var tempGraphics = ninja.attachAsset(ninja.runFrames[j], {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ if (self.intersects(ninja)) {
+ shieldCollected = true;
+ break;
+ }
+ ninja.removeChild(tempGraphics);
+ }
+ if (shieldCollected) {
+ console.log("Shield");
+ ninja.invincible = true;
+ ninjaGraphics.tint = 0x0000ff; // Change tint to blue
+ // Add shield icon and timer display
+ if (!ninja.shieldIcon) {
+ ninja.shieldIcon = new Text2('10s', {
+ size: 100,
+ fill: "#ffffff"
+ });
+ ninja.shieldIcon.anchor.set(0.5, 0.5);
+ ninja.shieldIcon.x = 100;
+ ninja.shieldIcon.y = 2732 / 2;
+ LK.gui.left.addChild(ninja.shieldIcon);
+ }
+ var shieldTimeLeft = 10;
+ ninja.shieldInterval = LK.setInterval(function () {
+ shieldTimeLeft--;
+ ninja.shieldIcon.setText(shieldTimeLeft + 's');
+ if (shieldTimeLeft <= 0) {
+ LK.clearInterval(ninja.shieldInterval);
+ ninja.shieldIcon.destroy();
+ ninja.shieldIcon = null;
+ }
+ }, 1000);
+ if (ninja.shieldTimeout) {
+ LK.clearTimeout(ninja.shieldTimeout);
+ }
+ ninja.shieldTimeout = LK.setTimeout(function () {
+ ninja.invincible = false;
+ ninjaGraphics.tint = 0xffffff; // Reset tint to default
+ ninja.shieldTimeout = null;
+ if (ninja.shieldIcon) {
+ ninja.shieldIcon.destroy();
+ ninja.shieldIcon = null;
+ }
+ LK.clearInterval(ninja.shieldInterval);
+ }, 10000);
+ self.destroy();
+ shields.splice(shields.indexOf(self), 1);
+ }
+ }
};
});
/****
Ninja Star. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A minimalist icon depicting a ninja head silhouette in black. The silhouette should be simple and recognizable, with a headband or mask detail. The background should be transparent or a contrasting color (e.g., red or white).. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Coin. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Shield. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Transparent sheild bubble. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a series of curved, tapered lines that originate from the ninja's body and extend outward in the direction of movement. The lines should vary in length and thickness, with a sense of energy and dynamism.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
backgroundMusic
Sound effect
coinCollect
Sound effect
jumpSound
Sound effect
footstepSound1
Sound effect
footstepSound2
Sound effect
footstepSound3
Sound effect
shooterSpawn
Sound effect
destructorSpawn
Sound effect
attackerSpawn
Sound effect
shooterAttack
Sound effect
destructorAttack
Sound effect
attackerAttack
Sound effect
enemyHit
Sound effect
shieldCollect
Sound effect
shieldCollectSound
Sound effect
ninjaGrunt
Sound effect
destructorAttackSound
Sound effect