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('bossChristian', {
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;
if (gameState === 'voting' || gameState === 'votingComplete') return; // Pause during voting phase and voting completion
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('faithVictory').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 Christian = Container.expand(function (colorAsset) {
var self = Container.call(this);
var graphics = self.attachAsset(colorAsset || 'christian', {
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;
if (gameState === 'voting' || gameState === 'votingComplete') return; // Pause during voting phase and voting completion
// 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('christianDefeated').play();
scoreTxt.setText(LK.getScore());
// Remove from christians array
for (var i = christians.length - 1; i >= 0; i--) {
if (christians[i] === self) {
christians.splice(i, 1);
break;
}
}
// Check if all christians eliminated
if (christians.length === 0) {
startNextRound();
} else {
// End voting phase after short delay
LK.setTimeout(function () {
endVotingPhase();
}, 1000);
}
}
};
return self;
});
var Mosque = Container.expand(function () {
var self = Container.call(this);
var graphics = self.attachAsset('mosque', {
anchorX: 0.5,
anchorY: 0.5
});
self.isCompleted = false;
return self;
});
var Muslim = Container.expand(function () {
var self = Container.call(this);
var graphics = self.attachAsset('muslim', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 8;
self.isAlive = true;
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a2e
});
/****
* Game Code
****/
// Game variables
var player;
var christians = [];
var mosques = [];
var mosqueArea = {};
var gameState = 'playing'; // 'playing', 'praying', 'roundEnd'
var roundNumber = 1;
var prayersCompleted = 0;
var prayingTimer = 0;
var prayingDuration = 5000; // 5 seconds for praying
var dragNode = null;
// Missing variables that are referenced in the code
var shipBounds = {};
var impostors = [];
var taskStations = [];
var votingTimer = 0;
var votingDuration = 10000; // 10 seconds for voting
var tasksCompleted = 0;
// Level system variables
var currentLevel = 1;
var maxLevel = 4;
var currentBoss = null;
var levelNames = ['Main Mosque', 'Prayer Hall', 'Minaret', 'Sacred Courtyard'];
var levelBackgrounds = ['courtyard', 'mainMosque', 'prayerHall', 'minaret'];
var currentMosque = null;
var isLevelTransition = false;
var levelTransitionDuration = 8000; // 8 seconds pause between levels
var isLevelCompleted = false;
// 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('Visit mosques to pray and avoid the pursuers!', {
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 Mosque', {
size: 60,
fill: 0xff9900
});
levelTxt.anchor.set(0, 0);
levelTxt.y = 80;
LK.gui.topLeft.addChild(levelTxt);
levelTxt.x = 120;
var levelTransitionTxt = new Text2('', {
size: 120,
fill: 0xffff00
});
levelTransitionTxt.anchor.set(0.5, 0.5);
LK.gui.center.addChild(levelTransitionTxt);
levelTransitionTxt.alpha = 0;
// Continue button for level completion
var continueBtn = new Text2('CONTINUE', {
size: 100,
fill: 0x00ff00
});
continueBtn.anchor.set(0.5, 0.5);
continueBtn.y = 200;
LK.gui.center.addChild(continueBtn);
continueBtn.alpha = 0;
continueBtn.interactive = true;
// Create level background
function createLevelBackground() {
if (currentMosque && currentMosque.parent) {
currentMosque.destroy();
}
var backgroundAsset = levelBackgrounds[currentLevel - 1] || 'courtyard';
currentMosque = game.attachAsset(backgroundAsset, {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
});
// Update mosque boundaries after creating new background
mosqueArea = {
left: currentMosque.x - currentMosque.width / 2,
right: currentMosque.x + currentMosque.width / 2,
top: currentMosque.y - currentMosque.height / 2,
bottom: currentMosque.y + currentMosque.height / 2
};
// Create fresh mosques for the new level
createMosques();
}
createLevelBackground();
// Set mosque boundaries
mosqueArea = {
left: currentMosque.x - currentMosque.width / 2,
right: currentMosque.x + currentMosque.width / 2,
top: currentMosque.y - currentMosque.height / 2,
bottom: currentMosque.y + currentMosque.height / 2
};
// Initialize shipBounds to match mosqueArea
shipBounds = {
left: mosqueArea.left,
right: mosqueArea.right,
top: mosqueArea.top,
bottom: mosqueArea.bottom
};
// Create player
player = game.addChild(new Muslim());
player.x = 1024;
player.y = 1600;
// Create mosques
function createMosques() {
// Destroy existing mosques first
for (var i = 0; i < mosques.length; i++) {
if (mosques[i].parent) {
mosques[i].destroy();
}
}
mosques = [];
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 mosque = game.addChild(new Mosque());
mosque.x = positions[i].x;
mosque.y = positions[i].y;
mosque.isCompleted = false; // Ensure mosque starts uncompleted
mosques.push(mosque);
}
}
// 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 Christians for current round
function createChristians() {
christians = [];
// Boss levels (every 3rd round) have boss instead of regular Christians
if (roundNumber % 3 === 0) {
createBoss();
return; // No regular Christians on boss rounds
}
var christianCount = Math.min(roundNumber + 1, 4);
var colors = ['christian', 'christian2', 'christian3', 'christian'];
for (var i = 0; i < christianCount; i++) {
var christian = game.addChild(new Christian(colors[i % colors.length]));
christian.x = mosqueArea.left + 100 + Math.random() * (mosqueArea.right - mosqueArea.left - 200);
christian.y = mosqueArea.top + 100 + Math.random() * (mosqueArea.bottom - mosqueArea.top - 200);
christian.speed = 4 + roundNumber * 0.8;
christians.push(christian);
}
// Set impostors to reference christians for compatibility
impostors = christians;
// Set taskStations to reference mosques for compatibility
taskStations = mosques;
}
// Initialize first round
createMosques();
createChristians();
// 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 Christians! Time: ' + Math.ceil((votingDuration - votingTimer) / 1000));
// Highlight remaining christians
for (var i = 0; i < christians.length; i++) {
if (!christians[i].isIdentified) {
tween(christians[i], {
alpha: 0.7
}, {
duration: 300
});
}
}
}
}
// End voting phase
function endVotingPhase() {
gameState = 'playing';
isLevelCompleted = true;
// Reset mosque tint to normal after voting phase
for (var i = 0; i < mosques.length; i++) {
if (mosques[i].tint !== undefined) {
mosques[i].tint = 0xffffff;
}
}
// Show voting completion text
if (roundNumber % 3 === 0) {
levelTransitionTxt.setText('Boss Fight Complete!');
} else {
levelTransitionTxt.setText('Voting Phase Complete!');
}
tween(levelTransitionTxt, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
// Show continue button after text appears
tween(continueBtn, {
alpha: 1,
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 800,
easing: tween.easeOut
});
}
});
}
// Start level transition with pause
function startLevelTransition() {
isLevelTransition = true;
isLevelCompleted = true;
gameState = 'levelCompleted';
// Show level completion text
levelTransitionTxt.setText('Level ' + (currentLevel - 1) + ' Complete!');
tween(levelTransitionTxt, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
// Show continue button after text appears
tween(continueBtn, {
alpha: 1,
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 800,
easing: tween.easeOut
});
}
});
}
// Handle continue button click
continueBtn.down = function (x, y, obj) {
if (isLevelCompleted) {
// Fade out completion UI
tween(levelTransitionTxt, {
alpha: 0
}, {
duration: 500
});
tween(continueBtn, {
alpha: 0,
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 500,
onFinish: function onFinish() {
isLevelCompleted = false;
isLevelTransition = false;
if (gameState === 'votingComplete') {
// Continue from voting completion
gameState = 'playing';
gameStateTxt.setText('Complete tasks and avoid impostors!');
// Reset christian alpha
for (var i = 0; i < christians.length; i++) {
if (!christians[i].isIdentified) {
christians[i].alpha = 1;
}
}
} else {
// Continue from level completion
gameState = 'playing';
continueNextRound();
}
}
});
}
};
// Continue next round after transition
function continueNextRound() {
prayersCompleted = 0; // Reset prayers completed for new round
roundTxt.setText('Round ' + roundNumber);
// Clean up old christians
for (var i = 0; i < christians.length; i++) {
if (christians[i].parent) {
christians[i].destroy();
}
}
// Clean up boss
if (currentBoss && currentBoss.parent) {
currentBoss.destroy();
currentBoss = null;
}
// Reset mosques
for (var i = 0; i < mosques.length; i++) {
mosques[i].isCompleted = false;
if (mosques[i].tint !== undefined) {
mosques[i].tint = 0xffffff;
}
}
// Create new christians or boss
createChristians();
// Update game state text based on round type
if (roundNumber % 3 === 0) {
gameStateTxt.setText('BOSS ROUND ' + roundNumber + ' - Complete prayers and prepare for final confrontation!');
} else {
gameStateTxt.setText('Round ' + roundNumber + ' - Complete prayers and avoid the pursuers!');
}
// Flash screen to indicate new round
LK.effects.flashScreen(0x0000ff, 500);
}
// Start next round
function startNextRound() {
roundNumber++;
tasksCompleted = 0;
prayersCompleted = 0; // Reset prayers completed for new round
// 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();
// Start level completion screen instead of immediately continuing
startLevelTransition();
return; // Exit early, transition will handle the rest
}
roundTxt.setText('Round ' + roundNumber);
// Clean up old christians
for (var i = 0; i < christians.length; i++) {
if (christians[i].parent) {
christians[i].destroy();
}
}
// Clean up boss
if (currentBoss && currentBoss.parent) {
currentBoss.destroy();
currentBoss = null;
}
// Reset mosques
for (var i = 0; i < mosques.length; i++) {
mosques[i].isCompleted = false;
if (mosques[i].tint !== undefined) {
mosques[i].tint = 0xffffff;
}
}
// Create new christians or boss
createChristians();
gameState = 'playing';
// Update game state text based on round type
if (roundNumber % 3 === 0) {
gameStateTxt.setText('BOSS ROUND ' + roundNumber + ' - Complete prayers and prepare for final confrontation!');
} else {
gameStateTxt.setText('Round ' + roundNumber + ' - Complete prayers and avoid the pursuers!');
}
// 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;
// Skip game logic during level transition or completion
if (isLevelTransition || gameState === 'transition' || gameState === 'levelCompleted' || gameState === 'votingComplete') {
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 christians
var remainingChristians = 0;
for (var i = 0; i < christians.length; i++) {
if (!christians[i].isIdentified) {
remainingChristians++;
}
}
// 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 (remainingChristians > 0) {
LK.effects.flashScreen(0xff0000, 1000);
gameStateTxt.setText('Voting failed! Some Christians remain...');
LK.setTimeout(function () {
endVotingPhase();
}, 2000);
} else {
endVotingPhase();
}
}
}
return;
}
if (gameState !== 'playing') return;
// Check collisions with christians (only non-identified ones)
for (var i = 0; i < christians.length; i++) {
if (!christians[i].isIdentified && player.intersects(christians[i])) {
// Player caught by christian
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 mosque prayer completion
for (var i = 0; i < mosques.length; i++) {
var mosque = mosques[i];
if (!mosque.isCompleted && player.intersects(mosque)) {
mosque.isCompleted = true;
if (mosque.tint !== undefined) {
mosque.tint = 0x00ff00;
}
prayersCompleted++;
LK.setScore(LK.getScore() + 50);
LK.getSound('taskComplete').play();
scoreTxt.setText('Score: ' + LK.getScore());
// Check if all prayers completed
if (prayersCompleted >= mosques.length) {
startVotingPhase();
}
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -428,9 +428,9 @@
}
}
// End voting phase
function endVotingPhase() {
- gameState = 'votingComplete';
+ gameState = 'playing';
isLevelCompleted = true;
// Reset mosque tint to normal after voting phase
for (var i = 0; i < mosques.length; i++) {
if (mosques[i].tint !== undefined) {