User prompt
BUTONUN REBGİNİ BEYAZ YAP VE BUTONU CAN BARININ YANINA KOY
User prompt
oyuna 1. bossa GİT BUTONU EKLE
User prompt
1. bossu yenince haani kötü adam bize bomba atıyoduya yani ben 1. bossu yendiğimde beni kötü adamın bana bomba attığı yere geçilsin
User prompt
1. bossu yenin ce hani bize bonba tıyodu bizle konuşuyoduya o bölüme at ve ayına 1. boss a geçi ekle
User prompt
hayır ben onu yenince beni you thoug ı lost kısmına at
User prompt
1. bossu yenince direkt beni villianla konuşmaya atsın
User prompt
sona git butonunu kaldır next scine kalsın
User prompt
tamam sona git butonunu kaldır
User prompt
inasanların konuşma baloncuğunu küçült ve rengini beyaz yap ayrıca bianalr yola değsin ve oyuna son sahneye geç butonu ekle
User prompt
sondaki yolu büyüt ve sondaki ahne 10 saniye sürsün ve sondakiler yani insanlar https://upit.com/create/8A6RcqBNGH/assets/images/f buna benzwsin sodaki sahneyide büyüt
User prompt
https://upit.com/create/8A6RcqBNGH/assets/images/road sonda üzerinde durdukları yol buna benzesin
User prompt
https://upit.com/create/8A6RcqBNGH/assets/images/a binalar buna benzesin sondaki ve insanın kafanını küçült ve 6 insan olsun karşılarında
User prompt
https://upit.com/create/8A6RcqBNGH/assets/images/s sondaki kalabalık insan topluluğu buna benzesin ve sonda arka plan siyah olmasın binalar 9lsun ve karşımızıdaki insanlar bize teşşekkür etsin bizde rica ederiz diyelim ingilizce ayrıca inan topluluğu solumuzda bizde onların sağında olalım
User prompt
sondaki konuşmalar beyaz olsun
User prompt
sondaki konuşmalr ingilizce olsun ve dünyaya ışınlanınca yeni bir map yap ve o mapda dünya olsun ve oradaki halk bize sizin sayenizde kurtulduk desin ingilizce
User prompt
sonda hani biz onu yok edince bir konuşma yeri daha varya onu kaldır onun yerşne https://upit.com/create/8A6RcqBNGH/assets/images/bossFace bu bize seninle dünyaya gelebilirmiyim desin ve bizde tamam diyelim sonra dümyaya ışınlanalım
User prompt
https://upit.com/create/8A6RcqBNGH/assets/images/bossFace bunun konuşmasının rengini beyaz yap ve üste al
User prompt
https://upit.com/create/8A6RcqBNGH/assets/images/bossFace ben stop dedikten sonraki konuşmalarda bu resimdeki canavar benle konuşacak
User prompt
sonda biz cnavarı yok edince oyun bitsin
User prompt
sondaki konuşmaları kaldır canavar üzerimize gelirken sonda ona bomba fırlatalım yok olsun sonra villain gelip you cant stop me desin ama cnavar gelirken ona bombayı atmak için ekrana 2 kere hızlıca tıklamalıyız bunu yapmamız gerektiğini cnavar gelmeden 3 saniye önce söyleki oyuncu ne yapacağını bilsin
User prompt
bak why ı shouldu söylerken boss un yüzü olsun why derkende boss un yüzü olsun
User prompt
konuşma baloncuğunda villamın yüzü değil bossun yüzü olsun sonda ben stop dedikten sonra
User prompt
sondaki konuşma 1. bossla benim aramda geçsin kötü adamla değil
User prompt
konuşma benle 1. boss arasında olsun
User prompt
bak sondaki 1. bossun gelip bizi öldürmesşnş kaldır 1. boss yanımıza gelip hadi birlik olalım desşn bizde ona güvenmesekte başka şansımızın olmadığı için tamam diyelim sonra 2. boss gelüp siz bittiniz deyip bize saldırsın ve ikimiz ona karşı savaşalım
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Boss Class
var Boss = Container.expand(function () {
var self = Container.call(this);
// Attach unique boss face asset
var bossFace = self.attachAsset('bossFace', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.2,
scaleY: 2.2
});
self.bossFace = bossFace;
self.speed = 8;
self.targetX = 2048 / 2;
self.targetY = 800;
// Boss starts at top, then chases player
self.x = 2048 / 2;
self.y = -bossFace.height;
self.update = function () {
// Move boss into screen, then chase player
if (self.y < self.targetY) {
self.y += 18;
if (self.y > self.targetY) self.y = self.targetY;
} else {
// Chase player
var dx = playerBall.x - self.x;
var dy = playerBall.y - self.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist > 10) {
self.x += dx / dist * self.speed;
self.y += dy / dist * self.speed * 0.7;
}
}
};
return self;
});
// Damage Ball Class
var DamageBall = Container.expand(function () {
var self = Container.call(this);
// Attach a yellow ball asset
var ball = self.attachAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.1,
scaleY: 1.1
});
ball.tint = 0xffe600;
self.ball = ball;
self.speed = 18;
// Random X within game area
var r = ball.width / 2;
self.x = Math.random() * (2048 - 2 * r) + r;
self.y = -r - 10;
self.update = function () {
self.y += self.speed;
};
return self;
});
// Start the boss chase phase
// Enemy Ball Class
var EnemyBall = Container.expand(function () {
var self = Container.call(this);
// Attach enemy ball asset (red circle)
var ball = self.attachAsset('enemyBall', {
anchorX: 0.5,
anchorY: 0.5
});
// Assign ball asset to self.ball for external access
self.ball = ball;
// Speed will be set on creation
self.speed = 6;
// Update method: move down
self.update = function () {
self.y += self.speed;
};
return self;
});
// Player Ball Class
var PlayerBall = Container.expand(function () {
var self = Container.call(this);
// Attach player ball asset (blue circle)
var ball = self.attachAsset('playerBall', {
anchorX: 0.5,
anchorY: 0.5
});
// For possible future use (e.g., effects)
self.ball = ball;
// No update needed; position is controlled by drag
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x181818 // Dark background
});
/****
* Game Code
****/
// new unique villain face
// new unique villain face
// --- Second Boss Phase Variables (moved to global scope for access in update and reset) ---
// --- Asset Initialization (shapes) ---
// Tween plugin for future use (animations, etc.)
// --- Game Variables ---
// Start the boss chase phase
// Monster entrance sound (villain/boss)
var secondBoss = null;
var secondBossHealth = 1000;
var secondBossHealthTxt = null;
var inSecondBossPhase = false;
var secondBossDamageBalls = [];
var secondBossDamageBallSpawnTicks = 0;
function startChasePhase() {
inChasePhase = true;
// Remove all enemies
for (var i = 0; i < enemyBalls.length; i++) {
enemyBalls[i].destroy();
}
enemyBalls = [];
// Play monster music for boss phase
LK.playMusic('monsterMusic');
// Spawn boss
boss = new Boss();
game.addChild(boss);
// Show boss health
if (bossHealthTxt && bossHealthTxt.parent) bossHealthTxt.parent.removeChild(bossHealthTxt);
bossHealth = 500;
bossHealthTxt = new Text2("Boss: " + bossHealth, {
size: 90,
fill: 0xffe600,
font: "Arial, Helvetica, sans-serif"
});
// Place boss health bar below score, yellow color
bossHealthTxt.anchor.set(0.5, 0);
bossHealthTxt.x = 2048 / 2;
bossHealthTxt.y = 120; // just below score
LK.gui.top.addChild(bossHealthTxt);
// Reset damage balls
for (var j = 0; j < damageBalls.length; j++) {
damageBalls[j].destroy();
}
damageBalls = [];
damageBallSpawnTicks = 0;
}
// Spawn a damage ball
function spawnDamageBall() {
var dball = new DamageBall();
damageBalls.push(dball);
game.addChild(dball);
}
var playerBall;
var enemyBalls = [];
var lives = 3;
var score = 0;
var spawnInterval = 80; // Initial enemy spawn interval (ticks)
var enemySpeed = 6; // Initial enemy speed
var ticksSinceLastSpawn = 0;
var dragNode = null;
var lastGameOver = false;
// --- Boss & Chase Phase ---
var freezeEnemies = false;
var freezeTicks = 0;
var chasePhaseStarted = false;
var boss = null;
var bossHealth = 500;
var bossHealthTxt = null;
var damageBalls = [];
var damageBallSpawnTicks = 0;
var inChasePhase = false;
// --- Tap to Start Overlay & Villain Dialog Control ---
// (Removed tap-to-start overlay and tap logic. Game/dialog starts immediately.)
var gameStarted = true;
// Control for villain dialog per level (no tap-to-start)
var waitingForTap = false;
var pendingVillainText = null;
var pendingVillainState = null;
// Helper to show villain dialog (no tap-to-start overlay)
function showVillainAndWait(text, nextState) {
// Show villain dialog
showVillainBubble(text);
waitingForTap = false;
pendingVillainText = text;
pendingVillainState = nextState;
gameStarted = true;
}
// --- UI Elements ---
// Score Text
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// --- Add a button to skip to the first boss phase ---
var skipBossBtn = new Text2("1. Bossa Geç", {
size: 70,
fill: 0xffffff,
font: "Arial, Helvetica, sans-serif"
});
skipBossBtn.anchor.set(0.5, 0.5);
skipBossBtn.x = 2048 - 220;
skipBossBtn.y = 180;
skipBossBtn.interactive = true;
skipBossBtn.buttonMode = true;
skipBossBtn.down = function () {
// Remove button after use
if (skipBossBtn && skipBossBtn.parent) skipBossBtn.parent.removeChild(skipBossBtn);
// Jump to boss phase
villainState = 3.25;
// Remove all enemies
for (var i = 0; i < enemyBalls.length; i++) {
enemyBalls[i].destroy();
}
enemyBalls = [];
// Remove all damage balls
for (var j = 0; j < damageBalls.length; j++) {
damageBalls[j].destroy();
}
damageBalls = [];
// Remove all second boss balls
for (var k = 0; k < secondBossDamageBalls.length; k++) {
secondBossDamageBalls[k].destroy();
}
secondBossDamageBalls = [];
// Remove boss if exists
if (boss && boss.parent) boss.parent.removeChild(boss);
boss = null;
if (bossHealthTxt && bossHealthTxt.parent) bossHealthTxt.parent.removeChild(bossHealthTxt);
bossHealthTxt = null;
// Remove second boss if exists
if (secondBoss && secondBoss.parent) secondBoss.parent.removeChild(secondBoss);
secondBoss = null;
if (secondBossHealthTxt && secondBossHealthTxt.parent) secondBossHealthTxt.parent.removeChild(secondBossHealthTxt);
secondBossHealthTxt = null;
// Reset flags
inChasePhase = false;
inSecondBossPhase = false;
freezeEnemies = false;
chasePhaseStarted = false;
// Start boss phase
startChasePhase();
};
LK.gui.topRight.addChild(skipBossBtn);
// --- Add a button to go to the first boss ---
var goToBossBtn = new Text2("1. Boss'a Git", {
size: 70,
fill: 0xffffff,
font: "Arial, Helvetica, sans-serif"
});
goToBossBtn.anchor.set(0, 0);
goToBossBtn.x = 2048 - 380;
goToBossBtn.y = 180;
goToBossBtn.interactive = true;
goToBossBtn.buttonMode = true;
goToBossBtn.down = function () {
// Remove button after use
if (goToBossBtn && goToBossBtn.parent) goToBossBtn.parent.removeChild(goToBossBtn);
// Jump directly to first boss fight
villainState = 3.25;
// Remove all enemies
for (var i = 0; i < enemyBalls.length; i++) {
enemyBalls[i].destroy();
}
enemyBalls = [];
// Remove all damage balls
for (var j = 0; j < damageBalls.length; j++) {
damageBalls[j].destroy();
}
damageBalls = [];
// Remove all second boss balls
for (var k = 0; k < secondBossDamageBalls.length; k++) {
secondBossDamageBalls[k].destroy();
}
secondBossDamageBalls = [];
// Remove boss if exists
if (boss && boss.parent) boss.parent.removeChild(boss);
boss = null;
if (bossHealthTxt && bossHealthTxt.parent) bossHealthTxt.parent.removeChild(bossHealthTxt);
bossHealthTxt = null;
// Remove second boss if exists
if (secondBoss && secondBoss.parent) secondBoss.parent.removeChild(secondBoss);
secondBoss = null;
if (secondBossHealthTxt && secondBossHealthTxt.parent) secondBossHealthTxt.parent.removeChild(secondBossHealthTxt);
secondBossHealthTxt = null;
// Reset flags
inChasePhase = false;
inSecondBossPhase = false;
freezeEnemies = false;
chasePhaseStarted = false;
// Start boss phase immediately
startChasePhase();
};
LK.gui.topRight.addChild(goToBossBtn);
// Lives Text
var livesTxt = new Text2('❤ 3', {
size: 90,
fill: 0xFF5252
});
livesTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(livesTxt);
// --- Player Ball Setup ---
playerBall = new PlayerBall();
game.addChild(playerBall);
// Start at bottom center, above the bottom edge
playerBall.x = 2048 / 2;
playerBall.y = 2732 - 220;
// --- Drag Handling ---
function handleMove(x, y, obj) {
// Allow movement during first boss fight (chase phase), but block only during final sequence or second boss phase
if (freezeEnemies && !inChasePhase && !inSecondBossPhase) return; // Prevent movement only in final sequence or second boss phase
if (dragNode) {
// Clamp to game area (keep ball fully visible)
var r = playerBall.ball.width / 2;
var minX = r,
maxX = 2048 - r;
var minY = r,
maxY = 2732 - r;
dragNode.x = Math.max(minX, Math.min(maxX, x));
dragNode.y = Math.max(minY, Math.min(maxY, y));
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
// Only start drag if touch/click is on the player ball
var dx = x - playerBall.x;
var dy = y - playerBall.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist <= playerBall.ball.width / 2) {
dragNode = playerBall;
handleMove(x, y, obj);
}
};
game.up = function (x, y, obj) {
dragNode = null;
};
// --- Enemy Spawning ---
function spawnEnemy() {
var enemy = new EnemyBall();
// Random X within game area, keeping ball fully visible
var r = enemy.ball.width / 2;
enemy.x = Math.random() * (2048 - 2 * r) + r;
enemy.y = -r - 10; // Start just above the screen
enemy.speed = enemySpeed + Math.random() * 2; // Add a bit of speed variation
enemyBalls.push(enemy);
game.addChild(enemy);
}
// --- Story & Level State ---
var villainState = 0; // 0: intro, 1: after 50, 2: after 100, 3: after 250 (win)
var villainBubble = null;
var villainTimeout = null;
var villainShowTicks = 0;
var villainShowDuration = 180; // 3 seconds at 60fps
function showVillainBubble(text) {
// Play monster entrance sound
LK.getSound('monsterEntrance').play();
// Remove previous if exists
if (villainBubble && villainBubble.parent) villainBubble.parent.removeChild(villainBubble);
villainBubble = new Container();
// Villain face (unique villain face)
var face = LK.getAsset('villainFace', {
anchorX: 0.5,
anchorY: 1
});
face.x = 0;
face.y = 0;
villainBubble.addChild(face);
// Speech bubble (white rounded box)
var bubble = new Container();
var bubbleShape = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.5,
scaleY: 1.2
});
bubbleShape.tint = 0xffffff;
bubbleShape.alpha = 0.92;
bubble.addChild(bubbleShape);
// Text (English, white)
var txt = new Text2(text, {
size: 80,
fill: 0xffffff,
font: "Arial, Helvetica, sans-serif"
});
txt.anchor.set(0.5, 0.5);
bubble.addChild(txt);
bubble.x = 0;
bubble.y = -180;
villainBubble.addChild(bubble);
// Position villainBubble at top center, but lower for readability
villainBubble.x = 2048 / 2;
// Move villain dialog bubble further down so 'I DESTROYD WORLD' text does not cover the boss face
villainBubble.y = 700; // moved down from 520 to 700
game.addChild(villainBubble);
villainShowTicks = 0;
}
function removeVillainBubble() {
if (villainBubble && villainBubble.parent) villainBubble.parent.removeChild(villainBubble);
villainBubble = null;
villainShowTicks = 0;
}
// --- Game Update Loop ---
// (SONA GIT button removed as requested, Next Scene button in final scene remains)
game.update = function () {
// --- Villain Dialog Logic ---
if (villainBubble) {
villainShowTicks++;
if (villainShowTicks > villainShowDuration) {
removeVillainBubble();
}
}
// --- Level/Story Progression ---
// At each story point, show villain and advance automatically
if (villainState === 0 && LK.ticks < 10) {
showVillainAndWait("I will destroy the world!", 1);
villainState = 0.25;
}
if (villainState === 0.25) {
// Remove villain bubble after duration, then advance
if (!villainBubble) {
villainState = 1;
}
}
if (villainState === 1 && score >= 50) {
showVillainAndWait("You're finished now!", 2);
// Speed up balls
spawnInterval = Math.max(30, spawnInterval - 18);
enemySpeed += 3.5;
villainState = 1.25;
}
if (villainState === 1.25) {
if (!villainBubble) {
villainState = 2;
}
}
if (villainState === 2 && score >= 100) {
// At the start of 'Enough!' dialog, stop all music and block bombs/music
LK.stopMusic();
freezeEnemies = true;
freezeTicks = LK.ticks;
// Prevent bomb spawns and music during dialog
showVillainAndWait("Enough!", 3);
// Schedule villainEnoughMusic to start after dialog ends (5 seconds)
LK.setTimeout(function () {
// Only start music if still in correct state and dialog is gone
if (villainState === 2.25 && !villainBubble) {
LK.playMusic('villainEnoughMusic');
freezeEnemies = false;
}
}, 5000);
villainState = 2.25;
}
if (villainState === 2.25) {
// Wait for villain bubble to disappear, then allow bombs/music if not already done
if (!villainBubble) {
// If for some reason music didn't start (e.g. dialog skipped), start it now
if (!LK.isMusicPlaying) {
LK.playMusic('villainEnoughMusic');
}
freezeEnemies = false;
villainState = 3;
}
}
// Stop villainEnoughMusic at score 250
if (villainState >= 2.25 && LK.isMusicPlaying && score >= 250) {
LK.stopMusic();
}
if (villainState === 3 && score >= 250) {
showVillainAndWait("Stop right there!", 4);
villainState = 3.25;
// Freeze all enemies, but allow player to move
for (var i = 0; i < enemyBalls.length; i++) {
enemyBalls[i].frozen = true;
}
// Prevent new enemies from spawning
freezeEnemies = true;
freezeTicks = LK.ticks;
chasePhaseStarted = false;
}
if (villainState === 3.25) {
if (!villainBubble && !chasePhaseStarted) {
// After villain dialog, wait 10 seconds, then start chase
LK.setTimeout(function () {
showVillainAndWait("Taste this!", 5);
// After dialog, spawn boss and damage balls
LK.setTimeout(function () {
startChasePhase();
}, villainShowDuration * 16.7); // villainShowDuration is in ticks, convert to ms
}, 10000);
chasePhaseStarted = true;
}
// Do not advance villainState until chase phase is started
}
// --- Enemy Spawning ---
if (!freezeEnemies && !inChasePhase) {
ticksSinceLastSpawn++;
if (ticksSinceLastSpawn >= spawnInterval) {
spawnEnemy();
ticksSinceLastSpawn = 0;
}
}
// --- Difficulty Scaling ---
if (!freezeEnemies && !inChasePhase) {
// Every 600 ticks (~10 seconds), increase difficulty
if (LK.ticks % 600 === 0 && LK.ticks > 0) {
if (spawnInterval > 30) spawnInterval -= 8; // Faster spawns
if (enemySpeed < 22) enemySpeed += 1.2; // Faster enemies
}
}
// --- Update Enemies ---
for (var i = enemyBalls.length - 1; i >= 0; i--) {
var enemy = enemyBalls[i];
if (!enemy.frozen) {
enemy.update();
}
// Check collision with player
var collides = enemy.intersects(playerBall);
if (collides && !enemy.frozen) {
// Remove enemy
enemy.destroy();
enemyBalls.splice(i, 1);
// Lose a life
lives--;
livesTxt.setText('❤ ' + lives);
// Flash player ball
LK.effects.flashObject(playerBall, 0xff0000, 400);
// Game over if no lives left
if (lives <= 0 && !lastGameOver) {
lastGameOver = true;
LK.effects.flashScreen(0xff0000, 800);
LK.showGameOver();
return;
}
continue;
}
// Remove if off screen
if (enemy.y - enemy.ball.height / 2 > 2732 + 40) {
enemy.destroy();
enemyBalls.splice(i, 1);
// Score for dodging
score++;
scoreTxt.setText(score + '');
}
}
// --- Boss Chase Phase ---
if (inChasePhase && boss) {
boss.update();
// Check collision with player (lose instantly)
if (boss.intersects(playerBall) && !lastGameOver) {
lastGameOver = true;
LK.effects.flashScreen(0xff0000, 800);
LK.showGameOver();
return;
}
// Update damage balls
var _loop = function _loop() {
dball = damageBalls[j];
dball.update();
// If player collects damage ball
if (dball.intersects(playerBall)) {
// Remove damage ball
dball.destroy();
damageBalls.splice(j, 1);
// Deal 20 damage to boss
bossHealth -= 20;
if (bossHealth < 0) bossHealth = 0;
if (bossHealthTxt) bossHealthTxt.setText("Boss: " + bossHealth);
// Flash boss
LK.effects.flashObject(boss, 0xffe600, 400);
// If boss defeated, trigger bomb-throwing villain dialog sequence (skip double-tap, monster approach, etc.)
if (bossHealth <= 0 && !inSecondBossPhase) {
// Stop monster music as boss is defeated
LK.stopMusic();
// Remove first boss and health bar
if (boss && boss.parent) boss.parent.removeChild(boss);
boss = null;
if (bossHealthTxt && bossHealthTxt.parent) bossHealthTxt.parent.removeChild(bossHealthTxt);
bossHealthTxt = null;
// Remove all damage balls
for (k = 0; k < damageBalls.length; k++) {
damageBalls[k].destroy();
}
damageBalls = [];
inChasePhase = false;
// Remove all balls and UI
freezeEnemies = true;
inSecondBossPhase = false;
for (i = 0; i < enemyBalls.length; i++) {
enemyBalls[i].destroy();
}
enemyBalls = [];
for (j = 0; j < damageBalls.length; j++) {
damageBalls[j].destroy();
}
damageBalls = [];
if (bossHealthTxt && bossHealthTxt.parent) bossHealthTxt.parent.removeChild(bossHealthTxt);
bossHealthTxt = null;
// --- Jump directly to bomb-throwing villain dialog sequence ---
// Show villain dialog: "Bombaaa!" (simulate villain throwing bomb)
showVillainAndWait("Bombaaa!", 303);
// After villain dialog, start second boss phase
LK.setTimeout(function () {
// Set up for second boss phase
inSecondBossPhase = true;
freezeEnemies = false;
// Spawn second boss (villain) at center top
secondBoss = new Boss();
secondBoss.x = 2048 / 2;
secondBoss.y = 700;
game.addChild(secondBoss);
// Show second boss health
if (secondBossHealthTxt && secondBossHealthTxt.parent) secondBossHealthTxt.parent.removeChild(secondBossHealthTxt);
secondBossHealth = 1000;
secondBossHealthTxt = new Text2("Villain: " + secondBossHealth, {
size: 90,
fill: 0xffe600,
font: "Arial, Helvetica, sans-serif"
});
secondBossHealthTxt.anchor.set(0.5, 0);
secondBossHealthTxt.x = 2048 / 2;
secondBossHealthTxt.y = 120;
LK.gui.top.addChild(secondBossHealthTxt);
// Reset second boss damage balls
for (var q = 0; q < secondBossDamageBalls.length; q++) {
secondBossDamageBalls[q].destroy();
}
secondBossDamageBalls = [];
secondBossDamageBallSpawnTicks = 0;
// Show villain dialog: "You thought I lost?"
showVillainAndWait("You thought I lost?", 304);
}, villainShowDuration * 16.7); // Wait for villain dialog to finish before starting second boss phase
return {
v: void 0
};
}
}
// Remove if off screen
if (dball.y > 2732 + 80) {
dball.destroy();
damageBalls.splice(j, 1);
}
},
dball,
k,
i,
j,
finalMonster,
instructionBubble,
monsterApproachTicks,
doubleTapCount,
lastTapTime,
bombThrown,
originalDown,
oldUpdate,
_ret;
for (var j = damageBalls.length - 1; j >= 0; j--) {
_ret = _loop();
if (_ret) return _ret.v;
}
// Spawn damage balls every 90 ticks
damageBallSpawnTicks++;
if (damageBallSpawnTicks >= 90) {
spawnDamageBall();
damageBallSpawnTicks = 0;
}
}
// --- Second Boss Phase ---
if (inSecondBossPhase && secondBoss) {
secondBoss.update();
// If villain collides with player, game over
if (secondBoss.intersects(playerBall) && !lastGameOver) {
lastGameOver = true;
LK.effects.flashScreen(0xff0000, 800);
LK.showGameOver();
return;
}
// Update second boss damage balls
for (var n = secondBossDamageBalls.length - 1; n >= 0; n--) {
var sdball = secondBossDamageBalls[n];
sdball.update();
// If player collects damage ball
if (sdball.intersects(playerBall)) {
sdball.destroy();
secondBossDamageBalls.splice(n, 1);
// Deal 50 damage to second boss
secondBossHealth -= 50;
if (secondBossHealth < 0) secondBossHealth = 0;
if (secondBossHealthTxt) secondBossHealthTxt.setText("Villain: " + secondBossHealth);
LK.effects.flashObject(secondBoss, 0xffe600, 400);
// If second boss defeated
if (secondBossHealth <= 0 && !lastGameOver) {
lastGameOver = true;
// Boss explosion effect
if (secondBoss && secondBoss.parent) {
// Create a quick yellow flash and scale up for explosion
tween(secondBoss, {
scaleX: 3.5,
scaleY: 3.5,
alpha: 0
}, {
duration: 700,
easing: tween.cubicOut
});
LK.effects.flashObject(secondBoss, 0xffe600, 400);
LK.setTimeout(function () {
if (secondBoss && secondBoss.parent) secondBoss.parent.removeChild(secondBoss);
}, 700);
} else if (secondBoss && !secondBoss.parent) {
// fallback
secondBoss = null;
}
if (secondBossHealthTxt && secondBossHealthTxt.parent) secondBossHealthTxt.parent.removeChild(secondBossHealthTxt);
// Remove all second boss damage balls
for (var p = 0; p < secondBossDamageBalls.length; p++) {
secondBossDamageBalls[p].destroy();
}
secondBossDamageBalls = [];
// --- NEW: Second boss throws a bomb, screen flashes white, dialog sequence, then win ---
// Freeze all gameplay
freezeEnemies = true;
inSecondBossPhase = false;
// Create bomb at boss position, throw to player, then white flash
var bomb = new Container();
var bombAsset = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
bombAsset.tint = 0x222222;
bomb.addChild(bombAsset);
bomb.x = secondBoss && secondBoss.x ? secondBoss.x : 2048 / 2;
bomb.y = secondBoss && secondBoss.y ? secondBoss.y : 700;
game.addChild(bomb);
// Animate bomb to player position
tween(bomb, {
x: playerBall.x,
y: playerBall.y
}, {
duration: 700,
easing: tween.cubicOut,
onFinish: function onFinish() {
// White flash
LK.effects.flashScreen(0xffffff, 600);
// Remove bomb
if (bomb && bomb.parent) bomb.parent.removeChild(bomb);
// After flash, dialog sequence
LK.setTimeout(function () {
// Freeze everything, remove all balls
for (var i = 0; i < enemyBalls.length; i++) {
enemyBalls[i].destroy();
}
enemyBalls = [];
for (var j = 0; j < damageBalls.length; j++) {
damageBalls[j].destroy();
}
damageBalls = [];
for (var k = 0; k < secondBossDamageBalls.length; k++) {
secondBossDamageBalls[k].destroy();
}
secondBossDamageBalls = [];
// Remove all UI
if (bossHealthTxt && bossHealthTxt.parent) bossHealthTxt.parent.removeChild(bossHealthTxt);
bossHealthTxt = null;
if (secondBossHealthTxt && secondBossHealthTxt.parent) secondBossHealthTxt.parent.removeChild(secondBossHealthTxt);
secondBossHealthTxt = null;
// BossFace dialog: "Seninle dünyaya gelebilir miyim?" (Can I come to Earth with you?)
removeVillainBubble();
LK.setTimeout(function () {
var bossBubble = new Container();
var bossFaceImg = LK.getAsset('bossFace', {
anchorX: 0.5,
anchorY: 1,
scaleX: 1.2,
scaleY: 1.2
});
bossFaceImg.x = 0;
bossFaceImg.y = 0;
bossBubble.addChild(bossFaceImg);
var bubble = new Container();
var bubbleShape = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.2,
scaleY: 1.1
});
bubbleShape.tint = 0xffffff;
bubbleShape.alpha = 0.92;
bubble.addChild(bubbleShape);
var txt = new Text2("Can I come to Earth with you?", {
size: 70,
fill: 0xffffff,
font: "Arial, Helvetica, sans-serif"
});
txt.anchor.set(0.5, 0.5);
bubble.addChild(txt);
bubble.x = 0;
bubble.y = -160;
bossBubble.addChild(bubble);
bossBubble.x = 2048 / 2;
bossBubble.y = 320;
game.addChild(bossBubble);
// After 2s, player says "Sure!"
LK.setTimeout(function () {
if (bossBubble && bossBubble.parent) bossBubble.parent.removeChild(bossBubble);
var playerBubble = new Container();
var playerFace = LK.getAsset('playerBall', {
anchorX: 0.5,
anchorY: 1,
scaleX: 1.2,
scaleY: 1.2
});
playerFace.x = 0;
playerFace.y = 0;
playerBubble.addChild(playerFace);
var bubble = new Container();
var bubbleShape = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.2,
scaleY: 1.1
});
bubbleShape.tint = 0xffffff;
bubbleShape.alpha = 0.92;
bubble.addChild(bubbleShape);
var txt = new Text2("Sure!", {
size: 80,
fill: 0xffffff,
font: "Arial, Helvetica, sans-serif"
});
txt.anchor.set(0.5, 0.5);
bubble.addChild(txt);
bubble.x = 0;
bubble.y = -160;
playerBubble.addChild(bubble);
playerBubble.x = 2048 / 2;
playerBubble.y = 2732 - 400;
game.addChild(playerBubble);
// After 1.5s, both teleport to Earth (flash, then show new map and crowd dialog)
LK.setTimeout(function () {
if (playerBubble && playerBubble.parent) playerBubble.parent.removeChild(playerBubble);
// Teleport effect: white flash
LK.effects.flashScreen(0xffffff, 700);
// After flash, show new Earth map and crowd dialog
LK.setTimeout(function () {
// --- Show new city map scene with crowd and buildings ---
var cityScene = new Container();
// Draw city background using 'a' asset for buildings (bigger, more city-like)
for (var b = 0; b < 8; b++) {
var building = LK.getAsset('a', {
anchorX: 0.5,
anchorY: 1,
scaleX: 3.2 + Math.random() * 1.7,
scaleY: 8.5 + Math.random() * 3.5
});
// Make buildings touch the road: align y to top of road
building.x = 180 + b * 250 + Math.random() * 60;
building.y = 2732 / 2 + 800 - building.height / 2 + 30; // road.y - road.height/2 + offset
cityScene.addChild(building);
}
// Draw ground (bigger)
var ground = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 12.5,
scaleY: 1.1
});
ground.tint = 0x4e944f;
ground.x = 2048 / 2;
ground.y = 2732 / 2 + 900;
cityScene.addChild(ground);
// Draw road under the people and player (much bigger)
var road = LK.getAsset('road', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 20,
scaleY: 2.2
});
road.x = 2048 / 2;
road.y = 2732 / 2 + 800;
cityScene.addChild(road);
// Add 6 people (use asset 'f', bigger, left side)
var people = [];
for (var i = 0; i < 6; i++) {
var person = LK.getAsset('f', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
person.x = 2048 / 2 - 600 + i * 120;
person.y = 2732 / 2 + 750 + Math.sin(i) * 28;
cityScene.addChild(person);
people.push(person);
}
// Add player (right of people group, smaller head)
var playerOnEarth = LK.getAsset('playerBall', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.0,
scaleY: 1.0
});
playerOnEarth.x = 2048 / 2 + 180;
playerOnEarth.y = 2732 / 2 + 750;
cityScene.addChild(playerOnEarth);
// Add boss (right of player, smaller head)
var bossOnEarth = LK.getAsset('bossFace', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.0,
scaleY: 1.0
});
bossOnEarth.x = playerOnEarth.x + 160;
bossOnEarth.y = playerOnEarth.y;
cityScene.addChild(bossOnEarth);
// Add crowd dialog bubble (above people group, white, English)
var crowdBubble = new Container();
var crowdBubbleShape = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.2,
// smaller bubble
scaleY: 0.9 // smaller bubble
});
crowdBubbleShape.tint = 0xffffff;
crowdBubbleShape.alpha = 0.95;
crowdBubble.addChild(crowdBubbleShape);
var crowdTxt = new Text2("Thanks to you, we are saved!", {
size: 60,
// smaller text
fill: 0xffffff,
// white text
font: "Arial, Helvetica, sans-serif"
});
crowdTxt.anchor.set(0.5, 0.5);
crowdBubble.addChild(crowdTxt);
// Center bubble above the group of people
crowdBubble.x = (people[2].x + people[3].x) / 2;
crowdBubble.y = people[0].y - 180;
cityScene.addChild(crowdBubble);
// Add player reply bubble (above player, white, English)
var playerReplyBubble = new Container();
var playerReplyBubbleShape = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.7,
scaleY: 1.3
});
playerReplyBubbleShape.tint = 0xffffff;
playerReplyBubbleShape.alpha = 0.95;
playerReplyBubble.addChild(playerReplyBubbleShape);
var playerReplyTxt = new Text2("You're welcome!", {
size: 90,
fill: 0x2196f3,
font: "Arial, Helvetica, sans-serif"
});
playerReplyTxt.anchor.set(0.5, 0.5);
playerReplyBubble.addChild(playerReplyTxt);
playerReplyBubble.x = playerOnEarth.x;
playerReplyBubble.y = playerOnEarth.y - 220;
cityScene.addChild(playerReplyBubble);
game.addChild(cityScene);
// After 10s, show win
LK.setTimeout(function () {
if (cityScene && cityScene.parent) cityScene.parent.removeChild(cityScene);
LK.showYouWin();
}, 10000);
}, 700);
}, 1500);
}, 2000);
}, 600);
}, 700);
}
});
return;
}
}
// Remove if off screen
if (sdball.y > 2732 + 80) {
sdball.destroy();
secondBossDamageBalls.splice(n, 1);
}
}
// Spawn second boss damage balls every 60 ticks (faster)
secondBossDamageBallSpawnTicks++;
if (secondBossDamageBallSpawnTicks >= 60) {
var sdb = new DamageBall();
sdb.ball.tint = 0xffe600;
secondBossDamageBalls.push(sdb);
game.addChild(sdb);
secondBossDamageBallSpawnTicks = 0;
}
}
};
// --- Reset Handler (for when game restarts) ---
game.on('destroy', function () {
// Clean up
for (var i = 0; i < enemyBalls.length; i++) {
enemyBalls[i].destroy();
}
enemyBalls = [];
// Remove boss if exists
if (boss && boss.parent) boss.parent.removeChild(boss);
boss = null;
// Remove boss health text
if (bossHealthTxt && bossHealthTxt.parent) bossHealthTxt.parent.removeChild(bossHealthTxt);
bossHealthTxt = null;
// Remove damage balls
for (var j = 0; j < damageBalls.length; j++) {
damageBalls[j].destroy();
}
damageBalls = [];
inChasePhase = false;
freezeEnemies = false;
chasePhaseStarted = false;
bossHealth = 500;
damageBallSpawnTicks = 0;
// Remove second boss and its UI
if (secondBoss && secondBoss.parent) secondBoss.parent.removeChild(secondBoss);
secondBoss = null;
if (secondBossHealthTxt && secondBossHealthTxt.parent) secondBossHealthTxt.parent.removeChild(secondBossHealthTxt);
secondBossHealthTxt = null;
for (var q = 0; q < secondBossDamageBalls.length; q++) {
secondBossDamageBalls[q].destroy();
}
secondBossDamageBalls = [];
inSecondBossPhase = false;
secondBossHealth = 1000;
secondBossDamageBallSpawnTicks = 0;
lives = 3;
score = 0;
spawnInterval = 80;
enemySpeed = 6;
ticksSinceLastSpawn = 0;
lastGameOver = false;
scoreTxt.setText('0');
livesTxt.setText('❤ 3');
// Reset player position
playerBall.x = 2048 / 2;
playerBall.y = 2732 - 220;
// Reset gameStarted and villain state
gameStarted = true;
waitingForTap = false;
pendingVillainText = null;
pendingVillainState = null;
villainState = 0;
removeVillainBubble();
}); ===================================================================
--- original.js
+++ change.js
@@ -256,11 +256,11 @@
size: 70,
fill: 0xffffff,
font: "Arial, Helvetica, sans-serif"
});
-goToBossBtn.anchor.set(0.5, 0.5);
-goToBossBtn.x = 2048 - 220;
-goToBossBtn.y = 280;
+goToBossBtn.anchor.set(0, 0);
+goToBossBtn.x = 2048 - 380;
+goToBossBtn.y = 180;
goToBossBtn.interactive = true;
goToBossBtn.buttonMode = true;
goToBossBtn.down = function () {
// Remove button after use