User prompt
delete voting phase
User prompt
voting phase ekranında imposto/hristiyanlar haraket edemesin
User prompt
voting phase bitince namaz kıla bilelim
User prompt
camiler voting phase bitince geri normala dönsün
User prompt
camiler yenilenmiyo
User prompt
2 levelde herşey gidiyo
User prompt
voting phase ekranındaki butona basılmadan önce impostorlar/hristiyanlar haraket edemiycek ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
voting phase ekranı geince hiç kimse hareket etmesin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
ekran gelince oyun dursun her ikisindede
User prompt
her voting ten sonrada ekran gelsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
her level bitiğinde bir ekran çıksın ekrandaki "devam et" tuşuna basıp yeni levele geçelim ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
beklemeyi uzat ve yazıları düzelt ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
leveler arasında bekleme olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'ReferenceError: impostors is not defined' in or related to this line: 'if (remainingChristians > 0) {' Line Number: 530
User prompt
oyun açılmıyo
User prompt
oyunun hikayesi "bir müslüman cami ye namaz kılmaya gidcekmiş sonra hristiyanlar onu kovalamış tüm cami lerde namaz kılarak hristiyanları imanla yencekmiş
User prompt
Please fix the bug: 'ship is not defined' in or related to this line: 'shipBounds = {' Line Number: 308
User prompt
başka bölümler olsun boss lardaolsun
User prompt
bizi kovalasınlar
Code edit (1 edits merged)
Please save this source code
User prompt
Impostor Hunt
Initial prompt
imanlı amongus
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Boss = Container.expand(function (level) { var self = Container.call(this); var graphics = self.attachAsset('bossImpostor', { anchorX: 0.5, anchorY: 0.5 }); self.level = level || 1; self.maxHealth = 3 + level; self.health = self.maxHealth; self.speed = 2 + level * 0.5; self.direction = Math.random() * Math.PI * 2; self.attackTimer = 0; self.attackCooldown = 2000; // 2 seconds self.isDead = false; self.chargeAttacking = false; self.chargeSpeed = 12; // Health bar var healthBarBg = self.addChild(LK.getAsset('shape', { width: 120, height: 20, color: 0x660000, shape: 'box', anchorX: 0.5, anchorY: 0.5, y: -100 })); var healthBar = self.addChild(LK.getAsset('shape', { width: 120, height: 16, color: 0xff0000, shape: 'box', anchorX: 0.5, anchorY: 0.5, y: -100 })); self.updateHealthBar = function () { var healthPercent = self.health / self.maxHealth; healthBar.width = 120 * healthPercent; }; self.update = function () { if (self.isDead) return; self.attackTimer += 16.67; // Boss AI behavior if (self.chargeAttacking) { // Charge attack - move fast towards player var deltaX = player.x - self.x; var deltaY = player.y - self.y; var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); if (distance > 10) { self.direction = Math.atan2(deltaY, deltaX); var newX = self.x + Math.cos(self.direction) * self.chargeSpeed; var newY = self.y + Math.sin(self.direction) * self.chargeSpeed; // Keep within bounds self.x = Math.max(shipBounds.left + 75, Math.min(shipBounds.right - 75, newX)); self.y = Math.max(shipBounds.top + 75, Math.min(shipBounds.bottom - 75, newY)); } // End charge attack after 1 second if (self.attackTimer >= 1000) { self.chargeAttacking = false; self.attackTimer = 0; } } else if (self.attackTimer >= self.attackCooldown) { // Start charge attack self.chargeAttacking = true; self.attackTimer = 0; LK.effects.flashObject(self, 0xffff00, 500); } else { // Normal movement - slower patrol var deltaX = player.x - self.x; var deltaY = player.y - self.y; var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); if (distance > 200) { // Move towards player if far away self.direction = Math.atan2(deltaY, deltaX); } else { // Random movement when close if (Math.random() < 0.02) { self.direction = Math.random() * Math.PI * 2; } } var newX = self.x + Math.cos(self.direction) * self.speed; var newY = self.y + Math.sin(self.direction) * self.speed; // Bounce off boundaries if (newX < shipBounds.left + 75 || newX > shipBounds.right - 75) { self.direction = Math.PI - self.direction; } if (newY < shipBounds.top + 75 || newY > shipBounds.bottom - 75) { self.direction = -self.direction; } // Keep within bounds self.x = Math.max(shipBounds.left + 75, Math.min(shipBounds.right - 75, newX)); self.y = Math.max(shipBounds.top + 75, Math.min(shipBounds.bottom - 75, newY)); } }; self.takeDamage = function () { if (self.isDead) return false; self.health--; self.updateHealthBar(); LK.effects.flashObject(self, 0xffffff, 300); if (self.health <= 0) { self.isDead = true; LK.setScore(LK.getScore() + 500); LK.getSound('bossDefeated').play(); scoreTxt.setText('Score: ' + LK.getScore()); return true; } return false; }; self.down = function (x, y, obj) { if (gameState === 'voting' && !self.isDead) { return self.takeDamage(); } }; return self; }); var Crewmate = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('crewmate', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.isAlive = true; return self; }); var Impostor = Container.expand(function (colorAsset) { var self = Container.call(this); var graphics = self.attachAsset(colorAsset || 'impostor', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 4; self.direction = Math.random() * Math.PI * 2; self.changeDirectionTimer = 0; self.isIdentified = false; self.update = function () { if (self.isIdentified) return; // Calculate direction towards player var deltaX = player.x - self.x; var deltaY = player.y - self.y; var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); // Only chase if player is alive and within reasonable distance if (player.isAlive && distance > 10) { // Calculate angle towards player self.direction = Math.atan2(deltaY, deltaX); // Add some randomness to make movement less predictable var randomOffset = (Math.random() - 0.5) * 0.3; self.direction += randomOffset; } // Move in current direction var newX = self.x + Math.cos(self.direction) * self.speed; var newY = self.y + Math.sin(self.direction) * self.speed; // Bounce off ship boundaries if (newX < shipBounds.left + 40 || newX > shipBounds.right - 40) { self.direction = Math.PI - self.direction; } if (newY < shipBounds.top + 40 || newY > shipBounds.bottom - 40) { self.direction = -self.direction; } // Keep within bounds self.x = Math.max(shipBounds.left + 40, Math.min(shipBounds.right - 40, newX)); self.y = Math.max(shipBounds.top + 40, Math.min(shipBounds.bottom - 40, newY)); }; self.down = function (x, y, obj) { if (gameState === 'voting' && !self.isIdentified) { // Player identified this impostor self.isIdentified = true; LK.setScore(LK.getScore() + 100); LK.effects.flashObject(self, 0x00ff00, 500); LK.getSound('impostorEliminated').play(); scoreTxt.setText(LK.getScore()); // Remove from impostors array for (var i = impostors.length - 1; i >= 0; i--) { if (impostors[i] === self) { impostors.splice(i, 1); break; } } // Check if all impostors eliminated if (impostors.length === 0) { startNextRound(); } else { // End voting phase after short delay LK.setTimeout(function () { endVotingPhase(); }, 1000); } } }; return self; }); var TaskStation = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('taskStation', { anchorX: 0.5, anchorY: 0.5 }); self.isCompleted = false; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a2e }); /**** * Game Code ****/ // Game variables var player; var impostors = []; var taskStations = []; var shipBounds = {}; var gameState = 'playing'; // 'playing', 'voting', 'roundEnd' var roundNumber = 1; var tasksCompleted = 0; var votingTimer = 0; var votingDuration = 5000; // 5 seconds for voting var dragNode = null; // Level system variables var currentLevel = 1; var maxLevel = 4; var currentBoss = null; var levelNames = ['Main Ship', 'Electrical Room', 'Medbay', 'Reactor Core']; var levelBackgrounds = ['ship', 'electricalRoom', 'medbay', 'reactor']; var currentShip = null; // UI Elements var scoreTxt = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var gameStateTxt = new Text2('Complete tasks and avoid impostors!', { size: 60, fill: 0xFFFF00 }); gameStateTxt.anchor.set(0.5, 0); gameStateTxt.y = 100; LK.gui.top.addChild(gameStateTxt); var roundTxt = new Text2('Round 1', { size: 70, fill: 0x00FFFF }); roundTxt.anchor.set(0, 0); LK.gui.topLeft.addChild(roundTxt); roundTxt.x = 120; // Avoid the menu icon var levelTxt = new Text2('Level 1: Main Ship', { size: 60, fill: 0xff9900 }); levelTxt.anchor.set(0, 0); levelTxt.y = 80; LK.gui.topLeft.addChild(levelTxt); levelTxt.x = 120; // Create level background function createLevelBackground() { if (currentShip && currentShip.parent) { currentShip.destroy(); } var backgroundAsset = levelBackgrounds[currentLevel - 1] || 'ship'; currentShip = game.attachAsset(backgroundAsset, { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 }); } createLevelBackground(); // Set ship boundaries shipBounds = { left: ship.x - ship.width / 2, right: ship.x + ship.width / 2, top: ship.y - ship.height / 2, bottom: ship.y + ship.height / 2 }; // Create player player = game.addChild(new Crewmate()); player.x = 1024; player.y = 1600; // Create task stations function createTaskStations() { taskStations = []; var positions = [{ x: 400, y: 800 }, { x: 1600, y: 800 }, { x: 800, y: 1000 }, { x: 1200, y: 1000 }, { x: 600, y: 1200 }]; for (var i = 0; i < positions.length; i++) { var station = game.addChild(new TaskStation()); station.x = positions[i].x; station.y = positions[i].y; taskStations.push(station); } } // Create boss for boss rounds function createBoss() { if (currentBoss && currentBoss.parent) { currentBoss.destroy(); } currentBoss = game.addChild(new Boss(currentLevel)); currentBoss.x = 1024; currentBoss.y = 800; } // Create impostors for current round function createImpostors() { impostors = []; // Boss levels (every 3rd round) have boss instead of regular impostors if (roundNumber % 3 === 0) { createBoss(); return; // No regular impostors on boss rounds } var impostorCount = Math.min(roundNumber + 1, 4); var colors = ['impostor', 'impostor2', 'impostor3', 'impostor']; for (var i = 0; i < impostorCount; i++) { var impostor = game.addChild(new Impostor(colors[i % colors.length])); impostor.x = shipBounds.left + 100 + Math.random() * (shipBounds.right - shipBounds.left - 200); impostor.y = shipBounds.top + 100 + Math.random() * (shipBounds.bottom - shipBounds.top - 200); impostor.speed = 4 + roundNumber * 0.8; impostors.push(impostor); } } // Initialize first round createTaskStations(); createImpostors(); // Start voting phase function startVotingPhase() { gameState = 'voting'; votingTimer = 0; // Check if this is a boss round if (roundNumber % 3 === 0 && currentBoss && !currentBoss.isDead) { gameStateTxt.setText('BOSS FIGHT: Tap the boss to damage! Time: ' + Math.ceil((votingDuration - votingTimer) / 1000)); tween(currentBoss, { alpha: 0.8 }, { duration: 300 }); } else { gameStateTxt.setText('VOTING: Tap on impostors! Time: ' + Math.ceil((votingDuration - votingTimer) / 1000)); // Highlight remaining impostors for (var i = 0; i < impostors.length; i++) { if (!impostors[i].isIdentified) { tween(impostors[i], { alpha: 0.7 }, { duration: 300 }); } } } } // End voting phase function endVotingPhase() { gameState = 'playing'; gameStateTxt.setText('Complete tasks and avoid impostors!'); // Reset impostor alpha for (var i = 0; i < impostors.length; i++) { if (!impostors[i].isIdentified) { impostors[i].alpha = 1; } } } // Start next round function startNextRound() { roundNumber++; tasksCompleted = 0; // Level progression every 3 rounds if (roundNumber % 3 === 1 && roundNumber > 1) { currentLevel = Math.min(currentLevel + 1, maxLevel); createLevelBackground(); levelTxt.setText('Level ' + currentLevel + ': ' + levelNames[currentLevel - 1]); LK.getSound('levelComplete').play(); } roundTxt.setText('Round ' + roundNumber); // Clean up old impostors for (var i = 0; i < impostors.length; i++) { if (impostors[i].parent) { impostors[i].destroy(); } } // Clean up boss if (currentBoss && currentBoss.parent) { currentBoss.destroy(); currentBoss = null; } // Reset task stations for (var i = 0; i < taskStations.length; i++) { taskStations[i].isCompleted = false; taskStations[i].tint = 0xffffff; } // Create new impostors or boss createImpostors(); gameState = 'playing'; // Update game state text based on round type if (roundNumber % 3 === 0) { gameStateTxt.setText('BOSS ROUND ' + roundNumber + ' - Complete tasks and prepare for boss fight!'); } else { gameStateTxt.setText('Round ' + roundNumber + ' - Complete tasks and avoid impostors!'); } // Flash screen to indicate new round LK.effects.flashScreen(0x0000ff, 500); } // Handle player movement function handleMove(x, y, obj) { if (dragNode && player.isAlive && gameState === 'playing') { var newX = Math.max(shipBounds.left + 40, Math.min(shipBounds.right - 40, x)); var newY = Math.max(shipBounds.top + 40, Math.min(shipBounds.bottom - 40, y)); dragNode.x = newX; dragNode.y = newY; } } game.move = handleMove; game.down = function (x, y, obj) { if (player.isAlive && gameState === 'playing') { dragNode = player; handleMove(x, y, obj); } }; game.up = function (x, y, obj) { dragNode = null; }; // Main game update loop game.update = function () { if (!player.isAlive) return; // Update voting timer if (gameState === 'voting') { votingTimer += 16.67; // Approximately 1/60th of a second var timeLeft = Math.ceil((votingDuration - votingTimer) / 1000); if (timeLeft > 0) { gameStateTxt.setText('VOTING: Tap on impostors! Time: ' + timeLeft); } else { // Voting time ended - penalty for remaining impostors var remainingImpostors = 0; for (var i = 0; i < impostors.length; i++) { if (!impostors[i].isIdentified) { remainingImpostors++; } } // Check if boss round if (roundNumber % 3 === 0) { if (currentBoss && !currentBoss.isDead) { LK.effects.flashScreen(0xff0000, 1000); gameStateTxt.setText('Boss fight failed! Boss still alive...'); LK.setTimeout(function () { endVotingPhase(); }, 2000); } else if (currentBoss && currentBoss.isDead) { startNextRound(); } else { endVotingPhase(); } } else { if (remainingImpostors > 0) { LK.effects.flashScreen(0xff0000, 1000); gameStateTxt.setText('Voting failed! Some impostors remain...'); LK.setTimeout(function () { endVotingPhase(); }, 2000); } else { endVotingPhase(); } } } return; } if (gameState !== 'playing') return; // Check collisions with impostors (only non-identified ones) for (var i = 0; i < impostors.length; i++) { if (!impostors[i].isIdentified && player.intersects(impostors[i])) { // Player caught by impostor player.isAlive = false; LK.effects.flashScreen(0xff0000, 1500); LK.getSound('elimination').play(); LK.showGameOver(); return; } } // Check collision with boss if (currentBoss && !currentBoss.isDead && player.intersects(currentBoss)) { // Player caught by boss player.isAlive = false; LK.effects.flashScreen(0xff0000, 1500); LK.getSound('elimination').play(); LK.showGameOver(); return; } // Check task completion for (var i = 0; i < taskStations.length; i++) { var station = taskStations[i]; if (!station.isCompleted && player.intersects(station)) { station.isCompleted = true; station.tint = 0x00ff00; tasksCompleted++; LK.setScore(LK.getScore() + 50); LK.getSound('taskComplete').play(); scoreTxt.setText('Score: ' + LK.getScore()); // Check if all tasks completed if (tasksCompleted >= taskStations.length) { startVotingPhase(); } } } };
===================================================================
--- original.js
+++ change.js
@@ -5,8 +5,123 @@
/****
* Classes
****/
+var Boss = Container.expand(function (level) {
+ var self = Container.call(this);
+ var graphics = self.attachAsset('bossImpostor', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.level = level || 1;
+ self.maxHealth = 3 + level;
+ self.health = self.maxHealth;
+ self.speed = 2 + level * 0.5;
+ self.direction = Math.random() * Math.PI * 2;
+ self.attackTimer = 0;
+ self.attackCooldown = 2000; // 2 seconds
+ self.isDead = false;
+ self.chargeAttacking = false;
+ self.chargeSpeed = 12;
+ // Health bar
+ var healthBarBg = self.addChild(LK.getAsset('shape', {
+ width: 120,
+ height: 20,
+ color: 0x660000,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5,
+ y: -100
+ }));
+ var healthBar = self.addChild(LK.getAsset('shape', {
+ width: 120,
+ height: 16,
+ color: 0xff0000,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5,
+ y: -100
+ }));
+ self.updateHealthBar = function () {
+ var healthPercent = self.health / self.maxHealth;
+ healthBar.width = 120 * healthPercent;
+ };
+ self.update = function () {
+ if (self.isDead) return;
+ self.attackTimer += 16.67;
+ // Boss AI behavior
+ if (self.chargeAttacking) {
+ // Charge attack - move fast towards player
+ var deltaX = player.x - self.x;
+ var deltaY = player.y - self.y;
+ var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
+ if (distance > 10) {
+ self.direction = Math.atan2(deltaY, deltaX);
+ var newX = self.x + Math.cos(self.direction) * self.chargeSpeed;
+ var newY = self.y + Math.sin(self.direction) * self.chargeSpeed;
+ // Keep within bounds
+ self.x = Math.max(shipBounds.left + 75, Math.min(shipBounds.right - 75, newX));
+ self.y = Math.max(shipBounds.top + 75, Math.min(shipBounds.bottom - 75, newY));
+ }
+ // End charge attack after 1 second
+ if (self.attackTimer >= 1000) {
+ self.chargeAttacking = false;
+ self.attackTimer = 0;
+ }
+ } else if (self.attackTimer >= self.attackCooldown) {
+ // Start charge attack
+ self.chargeAttacking = true;
+ self.attackTimer = 0;
+ LK.effects.flashObject(self, 0xffff00, 500);
+ } else {
+ // Normal movement - slower patrol
+ var deltaX = player.x - self.x;
+ var deltaY = player.y - self.y;
+ var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
+ if (distance > 200) {
+ // Move towards player if far away
+ self.direction = Math.atan2(deltaY, deltaX);
+ } else {
+ // Random movement when close
+ if (Math.random() < 0.02) {
+ self.direction = Math.random() * Math.PI * 2;
+ }
+ }
+ var newX = self.x + Math.cos(self.direction) * self.speed;
+ var newY = self.y + Math.sin(self.direction) * self.speed;
+ // Bounce off boundaries
+ if (newX < shipBounds.left + 75 || newX > shipBounds.right - 75) {
+ self.direction = Math.PI - self.direction;
+ }
+ if (newY < shipBounds.top + 75 || newY > shipBounds.bottom - 75) {
+ self.direction = -self.direction;
+ }
+ // Keep within bounds
+ self.x = Math.max(shipBounds.left + 75, Math.min(shipBounds.right - 75, newX));
+ self.y = Math.max(shipBounds.top + 75, Math.min(shipBounds.bottom - 75, newY));
+ }
+ };
+ self.takeDamage = function () {
+ if (self.isDead) return false;
+ self.health--;
+ self.updateHealthBar();
+ LK.effects.flashObject(self, 0xffffff, 300);
+ if (self.health <= 0) {
+ self.isDead = true;
+ LK.setScore(LK.getScore() + 500);
+ LK.getSound('bossDefeated').play();
+ scoreTxt.setText('Score: ' + LK.getScore());
+ return true;
+ }
+ return false;
+ };
+ self.down = function (x, y, obj) {
+ if (gameState === 'voting' && !self.isDead) {
+ return self.takeDamage();
+ }
+ };
+ return self;
+});
var Crewmate = Container.expand(function () {
var self = Container.call(this);
var graphics = self.attachAsset('crewmate', {
anchorX: 0.5,
@@ -112,8 +227,15 @@
var tasksCompleted = 0;
var votingTimer = 0;
var votingDuration = 5000; // 5 seconds for voting
var dragNode = null;
+// Level system variables
+var currentLevel = 1;
+var maxLevel = 4;
+var currentBoss = null;
+var levelNames = ['Main Ship', 'Electrical Room', 'Medbay', 'Reactor Core'];
+var levelBackgrounds = ['ship', 'electricalRoom', 'medbay', 'reactor'];
+var currentShip = null;
// UI Elements
var scoreTxt = new Text2('Score: 0', {
size: 80,
fill: 0xFFFFFF
@@ -133,15 +255,30 @@
});
roundTxt.anchor.set(0, 0);
LK.gui.topLeft.addChild(roundTxt);
roundTxt.x = 120; // Avoid the menu icon
-// Create ship background
-var ship = game.attachAsset('ship', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: 1024,
- y: 1366
+var levelTxt = new Text2('Level 1: Main Ship', {
+ size: 60,
+ fill: 0xff9900
});
+levelTxt.anchor.set(0, 0);
+levelTxt.y = 80;
+LK.gui.topLeft.addChild(levelTxt);
+levelTxt.x = 120;
+// Create level background
+function createLevelBackground() {
+ if (currentShip && currentShip.parent) {
+ currentShip.destroy();
+ }
+ var backgroundAsset = levelBackgrounds[currentLevel - 1] || 'ship';
+ currentShip = game.attachAsset(backgroundAsset, {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 1024,
+ y: 1366
+ });
+}
+createLevelBackground();
// Set ship boundaries
shipBounds = {
left: ship.x - ship.width / 2,
right: ship.x + ship.width / 2,
@@ -177,11 +314,25 @@
station.y = positions[i].y;
taskStations.push(station);
}
}
+// Create boss for boss rounds
+function createBoss() {
+ if (currentBoss && currentBoss.parent) {
+ currentBoss.destroy();
+ }
+ currentBoss = game.addChild(new Boss(currentLevel));
+ currentBoss.x = 1024;
+ currentBoss.y = 800;
+}
// Create impostors for current round
function createImpostors() {
impostors = [];
+ // Boss levels (every 3rd round) have boss instead of regular impostors
+ if (roundNumber % 3 === 0) {
+ createBoss();
+ return; // No regular impostors on boss rounds
+ }
var impostorCount = Math.min(roundNumber + 1, 4);
var colors = ['impostor', 'impostor2', 'impostor3', 'impostor'];
for (var i = 0; i < impostorCount; i++) {
var impostor = game.addChild(new Impostor(colors[i % colors.length]));
@@ -197,17 +348,27 @@
// Start voting phase
function startVotingPhase() {
gameState = 'voting';
votingTimer = 0;
- gameStateTxt.setText('VOTING: Tap on impostors! Time: ' + Math.ceil((votingDuration - votingTimer) / 1000));
- // Highlight remaining impostors
- for (var i = 0; i < impostors.length; i++) {
- if (!impostors[i].isIdentified) {
- tween(impostors[i], {
- alpha: 0.7
- }, {
- duration: 300
- });
+ // Check if this is a boss round
+ if (roundNumber % 3 === 0 && currentBoss && !currentBoss.isDead) {
+ gameStateTxt.setText('BOSS FIGHT: Tap the boss to damage! Time: ' + Math.ceil((votingDuration - votingTimer) / 1000));
+ tween(currentBoss, {
+ alpha: 0.8
+ }, {
+ duration: 300
+ });
+ } else {
+ gameStateTxt.setText('VOTING: Tap on impostors! Time: ' + Math.ceil((votingDuration - votingTimer) / 1000));
+ // Highlight remaining impostors
+ for (var i = 0; i < impostors.length; i++) {
+ if (!impostors[i].isIdentified) {
+ tween(impostors[i], {
+ alpha: 0.7
+ }, {
+ duration: 300
+ });
+ }
}
}
}
// End voting phase
@@ -224,24 +385,41 @@
// Start next round
function startNextRound() {
roundNumber++;
tasksCompleted = 0;
+ // Level progression every 3 rounds
+ if (roundNumber % 3 === 1 && roundNumber > 1) {
+ currentLevel = Math.min(currentLevel + 1, maxLevel);
+ createLevelBackground();
+ levelTxt.setText('Level ' + currentLevel + ': ' + levelNames[currentLevel - 1]);
+ LK.getSound('levelComplete').play();
+ }
roundTxt.setText('Round ' + roundNumber);
// Clean up old impostors
for (var i = 0; i < impostors.length; i++) {
if (impostors[i].parent) {
impostors[i].destroy();
}
}
+ // Clean up boss
+ if (currentBoss && currentBoss.parent) {
+ currentBoss.destroy();
+ currentBoss = null;
+ }
// Reset task stations
for (var i = 0; i < taskStations.length; i++) {
taskStations[i].isCompleted = false;
taskStations[i].tint = 0xffffff;
}
- // Create new impostors
+ // Create new impostors or boss
createImpostors();
gameState = 'playing';
- gameStateTxt.setText('Round ' + roundNumber + ' - Complete tasks and avoid impostors!');
+ // Update game state text based on round type
+ if (roundNumber % 3 === 0) {
+ gameStateTxt.setText('BOSS ROUND ' + roundNumber + ' - Complete tasks and prepare for boss fight!');
+ } else {
+ gameStateTxt.setText('Round ' + roundNumber + ' - Complete tasks and avoid impostors!');
+ }
// Flash screen to indicate new round
LK.effects.flashScreen(0x0000ff, 500);
}
// Handle player movement
@@ -279,16 +457,31 @@
if (!impostors[i].isIdentified) {
remainingImpostors++;
}
}
- if (remainingImpostors > 0) {
- LK.effects.flashScreen(0xff0000, 1000);
- gameStateTxt.setText('Voting failed! Some impostors remain...');
- LK.setTimeout(function () {
+ // Check if boss round
+ if (roundNumber % 3 === 0) {
+ if (currentBoss && !currentBoss.isDead) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ gameStateTxt.setText('Boss fight failed! Boss still alive...');
+ LK.setTimeout(function () {
+ endVotingPhase();
+ }, 2000);
+ } else if (currentBoss && currentBoss.isDead) {
+ startNextRound();
+ } else {
endVotingPhase();
- }, 2000);
+ }
} else {
- endVotingPhase();
+ if (remainingImpostors > 0) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ gameStateTxt.setText('Voting failed! Some impostors remain...');
+ LK.setTimeout(function () {
+ endVotingPhase();
+ }, 2000);
+ } else {
+ endVotingPhase();
+ }
}
}
return;
}
@@ -303,8 +496,17 @@
LK.showGameOver();
return;
}
}
+ // Check collision with boss
+ if (currentBoss && !currentBoss.isDead && player.intersects(currentBoss)) {
+ // Player caught by boss
+ player.isAlive = false;
+ LK.effects.flashScreen(0xff0000, 1500);
+ LK.getSound('elimination').play();
+ LK.showGameOver();
+ return;
+ }
// Check task completion
for (var i = 0; i < taskStations.length; i++) {
var station = taskStations[i];
if (!station.isCompleted && player.intersects(station)) {