User prompt
Ninja yıldızını oyundan tamamen kaldır
User prompt
Bomba sesi değil başka bir ses oluştur. Ninjahitstar 2 oluştur
User prompt
Ninja yıldızına değildinde bir ses daha çıksın
User prompt
Aynı bombada olduğu gibi ninja yıldızına değildinde ekrana kırmızı efekt gelsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ninja yıldızına değildinde 1 can azalsın
User prompt
Ninja, ninja yıldızına çarptığında efekt çıksın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ninja, ninja yıldızlarına değerse ses çıkarsın.
User prompt
Oyunda bazen ninja yıldızları da düşsün. Ninja eğer onlara değerse -50 puan alsın.
User prompt
Ninjanın canı bittiğinde ses çıkarsın.
User prompt
Ninja sağlık kitini aldığında bir ses çıksın.
User prompt
Oyunda nadiren yukarıdan sağlık kitleri düşsün. Ninja bir sağlık kiti aldığında bir can kazansın. Makas 5 cana kadar ulaşabilir. Ayrıca sağlık kitleri aşağıya düştüğünde puan azaltmayacak veya puan kazandırmayacak.
User prompt
Oyuna bir can mekanizması ekleyelim. Ninja meyveleri yakalayamadığında 1 canı gitsin. Ninja bombalara çarptığında 1 canı gitsin. Ninjanın toplam 5 canı olsun. Can sayısı sağ üstte gözüksün.
User prompt
Bombalar aşağıya düştüğünde ses çıkarmasın.
User prompt
Meyveler aşağıya düştüğünde bir ses çıkarsın.
User prompt
Ninja karpuza değdiğinde 20 puan kazansın.
User prompt
Oyuna meyve olarak karpuz da ekleyelim.Karpuz diğer meyvelere göre 2 kat daha hızlı düşsün. Ayrıca her 5 saniyede bir karpuz düşsün. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Oyun başladığında Backgroundmusic çalmaya başlasın.
User prompt
Oyunu açar açmaz düşen ejderha meyvesini kaldır.
User prompt
Oyuna başlar başlamaz bir ejderha meyvesi düşüyor. Oyunun ilk 10 saniyesinde sonra ejderha meyveleri düşmeye başlasın.
User prompt
Oyuna bir ejderha meyvesi ekleyelim. Ninja ejderha meyvesini aldığında 50 puan kazansın. Fakat ejderha meyvesi diğer meyvelere göre 2 kat daha hızlı düşsün. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Oyunda 2 dk süreli bir süre sayacı olsun.
User prompt
Ninja bombaya değdiğinde "ah!" Diye ses çıkarsın.
User prompt
Ninja bombaya dediğinde bombada patlama efekti olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Meyveleri aldığımızda efekt çıksın ve ses çıksın. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Score sayacının yazı fontunu japonya stili şeklinde yapalım ama japonca yapma.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Bomb = Container.expand(function () {
var self = Container.call(this);
var bombGraphics = self.attachAsset('bomb', {
anchorX: 0.5,
anchorY: 0.5
});
self.fallSpeed = 25 + Math.random() * 15;
self.penalty = 100;
self.update = function () {
self.y += self.fallSpeed;
};
return self;
});
var DragonFruit = Container.expand(function () {
var self = Container.call(this);
var dragonFruitGraphics = self.attachAsset('dragonFruit', {
anchorX: 0.5,
anchorY: 0.5
});
self.fallSpeed = (18 + Math.random() * 12) * 2; // Double speed
self.points = 50;
self.fruitType = 'dragonFruit';
self.update = function () {
self.y += self.fallSpeed;
};
return self;
});
var Fruit = Container.expand(function (fruitType) {
var self = Container.call(this);
var fruitGraphics = self.attachAsset(fruitType, {
anchorX: 0.5,
anchorY: 0.5
});
self.fallSpeed = 18 + Math.random() * 12;
self.points = 10;
self.fruitType = fruitType;
self.update = function () {
self.y += self.fallSpeed;
};
return self;
});
var HealthKit = Container.expand(function () {
var self = Container.call(this);
var healthKitGraphics = self.attachAsset('healthKit', {
anchorX: 0.5,
anchorY: 0.5
});
self.fallSpeed = 12 + Math.random() * 8; // Slower fall speed
self.points = 0; // No points for health kits
self.fruitType = 'healthKit';
self.update = function () {
self.y += self.fallSpeed;
};
return self;
});
var Ninja = Container.expand(function () {
var self = Container.call(this);
var ninjaGraphics = self.attachAsset('ninja', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 8;
return self;
});
var NinjaStar = Container.expand(function () {
var self = Container.call(this);
var ninjaStarGraphics = self.attachAsset('ninjaStar', {
anchorX: 0.5,
anchorY: 0.5
});
self.fallSpeed = 20 + Math.random() * 10;
self.penalty = 50;
self.update = function () {
self.y += self.fallSpeed;
// Add rotation for visual effect
ninjaStarGraphics.rotation += 0.1;
};
return self;
});
var Watermelon = Container.expand(function () {
var self = Container.call(this);
var watermelonGraphics = self.attachAsset('watermelon', {
anchorX: 0.5,
anchorY: 0.5
});
self.fallSpeed = (18 + Math.random() * 12) * 2; // Double speed
self.points = 20;
self.fruitType = 'watermelon';
self.update = function () {
self.y += self.fallSpeed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Add wooden background
var woodenBg = game.addChild(LK.getAsset('woodenBackground', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
}));
// Add wooden platform
var woodenPlatform = game.addChild(LK.getAsset('woodenPlatform', {
anchorX: 0.5,
anchorY: 1,
x: 2048 / 2,
y: 2732 - 50
}));
var ninja = game.addChild(new Ninja());
ninja.x = 2048 / 2;
ninja.y = 2732 - 350; // Position ninja higher above the platform
var fruits = [];
var bombs = [];
var fruitTypes = ['apple', 'banana', 'orange', 'grape'];
var dragonFruits = [];
var watermelons = [];
var spawnTimer = 0;
var spawnInterval = 120;
var bombSpawnTimer = 0;
var bombSpawnInterval = 300;
var watermelonSpawnTimer = 0;
var watermelonSpawnInterval = 300; // Every 5 seconds (5 * 60 fps)
var healthKits = [];
var healthKitSpawnTimer = 0;
var healthKitSpawnInterval = 1800; // Every 30 seconds (30 * 60 fps) - rare spawn
var ninjaStars = [];
var ninjaStarSpawnTimer = 0;
var ninjaStarSpawnInterval = 420; // Every 7 seconds (7 * 60 fps)
var difficultyTimer = 0;
var gameStartTimer = 0; // Track game time for dragon fruit spawning
var lives = 5; // Ninja has 5 lives
var scoreTxt = new Text2('Score: 0', {
size: 100,
fill: 0xFFFFFF,
font: "Impact, 'Arial Black', Tahoma"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Add lives display
var livesTxt = new Text2('Lives: ' + lives, {
size: 100,
fill: 0xFF0000,
font: "Impact, 'Arial Black', Tahoma"
});
livesTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(livesTxt);
// Add timer display
var timerTxt = new Text2('Time: 2:00', {
size: 80,
fill: 0xFFFFFF,
font: "Impact, 'Arial Black', Tahoma"
});
timerTxt.anchor.set(0.5, 0);
timerTxt.y = 120; // Position below score
LK.gui.top.addChild(timerTxt);
// Timer variables
var gameTime = 7200; // 2 minutes in ticks (120 seconds * 60 fps)
var gameEnded = false;
var dragNode = null;
function handleMove(x, y, obj) {
if (dragNode) {
dragNode.x = x;
if (dragNode.x < 180) dragNode.x = 180;
if (dragNode.x > 2048 - 180) dragNode.x = 2048 - 180;
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
dragNode = ninja;
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {
dragNode = null;
};
function spawnFruit() {
var randomType = fruitTypes[Math.floor(Math.random() * fruitTypes.length)];
var newFruit = game.addChild(new Fruit(randomType));
newFruit.x = 100 + Math.random() * (2048 - 200);
newFruit.y = -50;
newFruit.lastY = newFruit.y;
newFruit.lastIntersecting = false;
fruits.push(newFruit);
}
function spawnBomb() {
var newBomb = game.addChild(new Bomb());
newBomb.x = 100 + Math.random() * (2048 - 200);
newBomb.y = -50;
newBomb.lastY = newBomb.y;
newBomb.lastIntersecting = false;
bombs.push(newBomb);
}
function spawnDragonFruit() {
var newDragonFruit = game.addChild(new DragonFruit());
newDragonFruit.x = 100 + Math.random() * (2048 - 200);
newDragonFruit.y = -50;
newDragonFruit.lastY = newDragonFruit.y;
newDragonFruit.lastIntersecting = false;
dragonFruits.push(newDragonFruit);
}
function spawnWatermelon() {
var newWatermelon = game.addChild(new Watermelon());
newWatermelon.x = 100 + Math.random() * (2048 - 200);
newWatermelon.y = -50;
newWatermelon.lastY = newWatermelon.y;
newWatermelon.lastIntersecting = false;
watermelons.push(newWatermelon);
}
function spawnHealthKit() {
var newHealthKit = game.addChild(new HealthKit());
newHealthKit.x = 100 + Math.random() * (2048 - 200);
newHealthKit.y = -50;
newHealthKit.lastY = newHealthKit.y;
newHealthKit.lastIntersecting = false;
healthKits.push(newHealthKit);
}
function spawnNinjaStar() {
var newNinjaStar = game.addChild(new NinjaStar());
newNinjaStar.x = 100 + Math.random() * (2048 - 200);
newNinjaStar.y = -50;
newNinjaStar.lastY = newNinjaStar.y;
newNinjaStar.lastIntersecting = false;
ninjaStars.push(newNinjaStar);
}
game.update = function () {
// Check if game has ended
if (gameEnded) return;
// Update timer
gameTime--;
var minutes = Math.floor(gameTime / 3600);
var seconds = Math.floor(gameTime % 3600 / 60);
var timeString = minutes + ':' + (seconds < 10 ? '0' : '') + seconds;
timerTxt.setText('Time: ' + timeString);
// Check if time is up
if (gameTime <= 0) {
gameEnded = true;
LK.showGameOver();
return;
}
spawnTimer++;
bombSpawnTimer++;
watermelonSpawnTimer++;
healthKitSpawnTimer++;
ninjaStarSpawnTimer++;
difficultyTimer++;
gameStartTimer++;
// Increase difficulty over time
if (difficultyTimer % 1800 == 0 && spawnInterval > 30) {
spawnInterval -= 5;
}
// Spawn fruits with increasing frequency
var fruitsToSpawn = 1;
if (difficultyTimer > 3600) fruitsToSpawn = 2; // After 1 minute, spawn 2 fruits
if (difficultyTimer > 7200) fruitsToSpawn = 3; // After 2 minutes, spawn 3 fruits
if (difficultyTimer > 10800) fruitsToSpawn = 4; // After 3 minutes, spawn 4 fruits
if (spawnTimer >= spawnInterval) {
for (var j = 0; j < fruitsToSpawn; j++) {
spawnFruit();
}
spawnTimer = 0;
}
// Spawn bombs occasionally
if (bombSpawnTimer >= bombSpawnInterval) {
spawnBomb();
bombSpawnTimer = 0;
}
// Spawn dragon fruit occasionally after first 10 seconds (every 600 ticks = 10 seconds)
if (gameStartTimer >= 600 && LK.ticks % 600 == 0) {
spawnDragonFruit();
}
// Spawn watermelon every 5 seconds
if (watermelonSpawnTimer >= watermelonSpawnInterval) {
spawnWatermelon();
watermelonSpawnTimer = 0;
}
// Spawn health kit rarely (every 30 seconds)
if (healthKitSpawnTimer >= healthKitSpawnInterval) {
spawnHealthKit();
healthKitSpawnTimer = 0;
}
// Spawn ninja star occasionally (every 7 seconds)
if (ninjaStarSpawnTimer >= ninjaStarSpawnInterval) {
spawnNinjaStar();
ninjaStarSpawnTimer = 0;
}
// Update fruits
for (var i = fruits.length - 1; i >= 0; i--) {
var fruit = fruits[i];
// Check if fruit went off screen
if (fruit.lastY < 2732 + 100 && fruit.y >= 2732 + 100) {
// Play fruit fall sound
LK.getSound('fruitFall').play();
// Lose a life for missing fruit
lives--;
livesTxt.setText('Lives: ' + lives);
// Check if game over
if (lives <= 0) {
LK.getSound('gameOver').play();
gameEnded = true;
LK.showGameOver();
return;
}
// Penalty for missing fruit
LK.setScore(LK.getScore() - 50);
scoreTxt.setText('Score: ' + LK.getScore());
fruit.destroy();
fruits.splice(i, 1);
continue;
}
// Check collision with ninja
var currentIntersecting = fruit.intersects(ninja);
if (!fruit.lastIntersecting && currentIntersecting) {
LK.setScore(LK.getScore() + fruit.points);
scoreTxt.setText('Score: ' + LK.getScore());
// Play catch sound effect
LK.getSound('fruitCatch').play();
// Enhanced visual feedback with bounce effect
tween(fruit, {
scaleX: 1.8,
scaleY: 1.8,
alpha: 0.3,
rotation: Math.PI
}, {
duration: 300,
easing: tween.bounceOut,
onFinish: function onFinish() {
fruit.destroy();
}
});
// Additional sparkle effect - create a brief flash
LK.effects.flashObject(fruit, 0xFFD700, 200);
fruits.splice(i, 1);
continue;
}
fruit.lastY = fruit.y;
fruit.lastIntersecting = currentIntersecting;
}
// Update bombs
for (var k = bombs.length - 1; k >= 0; k--) {
var bomb = bombs[k];
// Check if bomb went off screen
if (bomb.lastY < 2732 + 100 && bomb.y >= 2732 + 100) {
bomb.destroy();
bombs.splice(k, 1);
continue;
}
// Check collision with ninja
var bombIntersecting = bomb.intersects(ninja);
if (!bomb.lastIntersecting && bombIntersecting) {
// Lose a life for hitting bomb
lives--;
livesTxt.setText('Lives: ' + lives);
// Check if game over
if (lives <= 0) {
LK.getSound('gameOver').play();
gameEnded = true;
LK.showGameOver();
return;
}
LK.setScore(LK.getScore() - bomb.penalty);
scoreTxt.setText('Score: ' + LK.getScore());
// Play explosion sound effect
LK.getSound('bombExplosion').play();
// Play ninja pain sound
LK.getSound('ninjaPain').play();
// Enhanced explosion visual effects
tween(bomb, {
scaleX: 2.5,
scaleY: 2.5,
alpha: 0,
rotation: Math.PI * 2
}, {
duration: 400,
easing: tween.easeOut,
onFinish: function onFinish() {
bomb.destroy();
}
});
// Flash effect for bomb hit
LK.effects.flashScreen(0xFF0000, 500);
// Additional explosive flash effect on the bomb itself
LK.effects.flashObject(bomb, 0xFFFFFF, 300);
bombs.splice(k, 1);
continue;
}
bomb.lastY = bomb.y;
bomb.lastIntersecting = bombIntersecting;
}
// Update dragon fruits
for (var d = dragonFruits.length - 1; d >= 0; d--) {
var dragonFruit = dragonFruits[d];
// Check if dragon fruit went off screen
if (dragonFruit.lastY < 2732 + 100 && dragonFruit.y >= 2732 + 100) {
// Play fruit fall sound
LK.getSound('fruitFall').play();
// Lose a life for missing dragon fruit
lives--;
livesTxt.setText('Lives: ' + lives);
// Check if game over
if (lives <= 0) {
LK.getSound('gameOver').play();
gameEnded = true;
LK.showGameOver();
return;
}
// Penalty for missing dragon fruit
LK.setScore(LK.getScore() - 75);
scoreTxt.setText('Score: ' + LK.getScore());
dragonFruit.destroy();
dragonFruits.splice(d, 1);
continue;
}
// Check collision with ninja
var dragonIntersecting = dragonFruit.intersects(ninja);
if (!dragonFruit.lastIntersecting && dragonIntersecting) {
LK.setScore(LK.getScore() + dragonFruit.points);
scoreTxt.setText('Score: ' + LK.getScore());
// Play catch sound effect
LK.getSound('fruitCatch').play();
// Enhanced visual feedback with special dragon fruit effect
tween(dragonFruit, {
scaleX: 2.2,
scaleY: 2.2,
alpha: 0.2,
rotation: Math.PI * 2
}, {
duration: 400,
easing: tween.bounceOut,
onFinish: function onFinish() {
dragonFruit.destroy();
}
});
// Special golden flash for dragon fruit
LK.effects.flashObject(dragonFruit, 0xFFD700, 300);
LK.effects.flashScreen(0xFFD700, 200);
dragonFruits.splice(d, 1);
continue;
}
dragonFruit.lastY = dragonFruit.y;
dragonFruit.lastIntersecting = dragonIntersecting;
}
// Update watermelons
for (var w = watermelons.length - 1; w >= 0; w--) {
var watermelon = watermelons[w];
// Check if watermelon went off screen
if (watermelon.lastY < 2732 + 100 && watermelon.y >= 2732 + 100) {
// Play fruit fall sound
LK.getSound('fruitFall').play();
// Lose a life for missing watermelon
lives--;
livesTxt.setText('Lives: ' + lives);
// Check if game over
if (lives <= 0) {
LK.getSound('gameOver').play();
gameEnded = true;
LK.showGameOver();
return;
}
// Penalty for missing watermelon
LK.setScore(LK.getScore() - 50);
scoreTxt.setText('Score: ' + LK.getScore());
watermelon.destroy();
watermelons.splice(w, 1);
continue;
}
// Check collision with ninja
var watermelonIntersecting = watermelon.intersects(ninja);
if (!watermelon.lastIntersecting && watermelonIntersecting) {
LK.setScore(LK.getScore() + watermelon.points);
scoreTxt.setText('Score: ' + LK.getScore());
// Play catch sound effect
LK.getSound('fruitCatch').play();
// Enhanced visual feedback with bounce effect
tween(watermelon, {
scaleX: 1.8,
scaleY: 1.8,
alpha: 0.3,
rotation: Math.PI
}, {
duration: 300,
easing: tween.bounceOut,
onFinish: function onFinish() {
watermelon.destroy();
}
});
// Additional sparkle effect - create a brief flash
LK.effects.flashObject(watermelon, 0xFFD700, 200);
watermelons.splice(w, 1);
continue;
}
watermelon.lastY = watermelon.y;
watermelon.lastIntersecting = watermelonIntersecting;
}
// Update health kits
for (var h = healthKits.length - 1; h >= 0; h--) {
var healthKit = healthKits[h];
// Check if health kit went off screen (no penalty or points)
if (healthKit.lastY < 2732 + 100 && healthKit.y >= 2732 + 100) {
healthKit.destroy();
healthKits.splice(h, 1);
continue;
}
// Check collision with ninja
var healthKitIntersecting = healthKit.intersects(ninja);
if (!healthKit.lastIntersecting && healthKitIntersecting) {
// Gain a life (max 5 lives)
if (lives < 5) {
lives++;
livesTxt.setText('Lives: ' + lives);
}
// Play health kit catch sound effect
LK.getSound('healthCatch').play();
// Enhanced visual feedback with healing effect
tween(healthKit, {
scaleX: 2.0,
scaleY: 2.0,
alpha: 0.2,
rotation: Math.PI
}, {
duration: 350,
easing: tween.bounceOut,
onFinish: function onFinish() {
healthKit.destroy();
}
});
// Special green flash for health kit
LK.effects.flashObject(healthKit, 0x00FF00, 300);
LK.effects.flashScreen(0x00FF00, 150);
healthKits.splice(h, 1);
continue;
}
healthKit.lastY = healthKit.y;
healthKit.lastIntersecting = healthKitIntersecting;
}
// Update ninja stars
for (var n = ninjaStars.length - 1; n >= 0; n--) {
var ninjaStar = ninjaStars[n];
// Check if ninja star went off screen
if (ninjaStar.lastY < 2732 + 100 && ninjaStar.y >= 2732 + 100) {
ninjaStar.destroy();
ninjaStars.splice(n, 1);
continue;
}
// Check collision with ninja
var ninjaStarIntersecting = ninjaStar.intersects(ninja);
if (!ninjaStar.lastIntersecting && ninjaStarIntersecting) {
// Lose 50 points for touching ninja star
LK.setScore(LK.getScore() - ninjaStar.penalty);
scoreTxt.setText('Score: ' + LK.getScore());
// Play ninja pain sound
LK.getSound('ninjaPain').play();
// Enhanced visual feedback with spinning effect
tween(ninjaStar, {
scaleX: 2.0,
scaleY: 2.0,
alpha: 0.2,
rotation: Math.PI * 3
}, {
duration: 400,
easing: tween.easeOut,
onFinish: function onFinish() {
ninjaStar.destroy();
}
});
// Flash effect for ninja star hit
LK.effects.flashObject(ninjaStar, 0xFF4500, 300);
ninjaStars.splice(n, 1);
continue;
}
ninjaStar.lastY = ninjaStar.y;
ninjaStar.lastIntersecting = ninjaStarIntersecting;
}
};
// Start background music when game begins
LK.playMusic('bgmusic'); ===================================================================
--- original.js
+++ change.js
@@ -69,8 +69,23 @@
});
self.speed = 8;
return self;
});
+var NinjaStar = Container.expand(function () {
+ var self = Container.call(this);
+ var ninjaStarGraphics = self.attachAsset('ninjaStar', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.fallSpeed = 20 + Math.random() * 10;
+ self.penalty = 50;
+ self.update = function () {
+ self.y += self.fallSpeed;
+ // Add rotation for visual effect
+ ninjaStarGraphics.rotation += 0.1;
+ };
+ return self;
+});
var Watermelon = Container.expand(function () {
var self = Container.call(this);
var watermelonGraphics = self.attachAsset('watermelon', {
anchorX: 0.5,
@@ -125,8 +140,11 @@
var watermelonSpawnInterval = 300; // Every 5 seconds (5 * 60 fps)
var healthKits = [];
var healthKitSpawnTimer = 0;
var healthKitSpawnInterval = 1800; // Every 30 seconds (30 * 60 fps) - rare spawn
+var ninjaStars = [];
+var ninjaStarSpawnTimer = 0;
+var ninjaStarSpawnInterval = 420; // Every 7 seconds (7 * 60 fps)
var difficultyTimer = 0;
var gameStartTimer = 0; // Track game time for dragon fruit spawning
var lives = 5; // Ninja has 5 lives
var scoreTxt = new Text2('Score: 0', {
@@ -212,8 +230,16 @@
newHealthKit.lastY = newHealthKit.y;
newHealthKit.lastIntersecting = false;
healthKits.push(newHealthKit);
}
+function spawnNinjaStar() {
+ var newNinjaStar = game.addChild(new NinjaStar());
+ newNinjaStar.x = 100 + Math.random() * (2048 - 200);
+ newNinjaStar.y = -50;
+ newNinjaStar.lastY = newNinjaStar.y;
+ newNinjaStar.lastIntersecting = false;
+ ninjaStars.push(newNinjaStar);
+}
game.update = function () {
// Check if game has ended
if (gameEnded) return;
// Update timer
@@ -231,8 +257,9 @@
spawnTimer++;
bombSpawnTimer++;
watermelonSpawnTimer++;
healthKitSpawnTimer++;
+ ninjaStarSpawnTimer++;
difficultyTimer++;
gameStartTimer++;
// Increase difficulty over time
if (difficultyTimer % 1800 == 0 && spawnInterval > 30) {
@@ -267,8 +294,13 @@
if (healthKitSpawnTimer >= healthKitSpawnInterval) {
spawnHealthKit();
healthKitSpawnTimer = 0;
}
+ // Spawn ninja star occasionally (every 7 seconds)
+ if (ninjaStarSpawnTimer >= ninjaStarSpawnInterval) {
+ spawnNinjaStar();
+ ninjaStarSpawnTimer = 0;
+ }
// Update fruits
for (var i = fruits.length - 1; i >= 0; i--) {
var fruit = fruits[i];
// Check if fruit went off screen
@@ -516,7 +548,45 @@
}
healthKit.lastY = healthKit.y;
healthKit.lastIntersecting = healthKitIntersecting;
}
+ // Update ninja stars
+ for (var n = ninjaStars.length - 1; n >= 0; n--) {
+ var ninjaStar = ninjaStars[n];
+ // Check if ninja star went off screen
+ if (ninjaStar.lastY < 2732 + 100 && ninjaStar.y >= 2732 + 100) {
+ ninjaStar.destroy();
+ ninjaStars.splice(n, 1);
+ continue;
+ }
+ // Check collision with ninja
+ var ninjaStarIntersecting = ninjaStar.intersects(ninja);
+ if (!ninjaStar.lastIntersecting && ninjaStarIntersecting) {
+ // Lose 50 points for touching ninja star
+ LK.setScore(LK.getScore() - ninjaStar.penalty);
+ scoreTxt.setText('Score: ' + LK.getScore());
+ // Play ninja pain sound
+ LK.getSound('ninjaPain').play();
+ // Enhanced visual feedback with spinning effect
+ tween(ninjaStar, {
+ scaleX: 2.0,
+ scaleY: 2.0,
+ alpha: 0.2,
+ rotation: Math.PI * 3
+ }, {
+ duration: 400,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ ninjaStar.destroy();
+ }
+ });
+ // Flash effect for ninja star hit
+ LK.effects.flashObject(ninjaStar, 0xFF4500, 300);
+ ninjaStars.splice(n, 1);
+ continue;
+ }
+ ninjaStar.lastY = ninjaStar.y;
+ ninjaStar.lastIntersecting = ninjaStarIntersecting;
+ }
};
// Start background music when game begins
LK.playMusic('bgmusic');
\ No newline at end of file
An apple. 2d. High contrast. No shadows
Banana. 2d. High contrast. No shadows
An orange. 2d. High contrast. No shadows
A grape. 2d. High contrast. No shadows
Cute Ninja. 2d. High contrast. No shadows
Wooden Background
A bomb. In-Game asset. 2d. High contrast. No shadows
A dragonfruit. In-Game asset. 2d. High contrast. No shadows
Wooden platfom straigth. In-Game asset. 2d. High contrast. No shadows
A watermelon. In-Game asset. 2d. High contrast. No shadows
A health kit. In-Game asset. 2d. High contrast. No shadows