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 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;
// 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
// Create ship background
var ship = game.attachAsset('ship', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
});
// 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 impostors for current round
function createImpostors() {
impostors = [];
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;
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;
roundTxt.setText('Round ' + roundNumber);
// Clean up old impostors
for (var i = 0; i < impostors.length; i++) {
if (impostors[i].parent) {
impostors[i].destroy();
}
}
// Reset task stations
for (var i = 0; i < taskStations.length; i++) {
taskStations[i].isCompleted = false;
taskStations[i].tint = 0xffffff;
}
// Create new impostors
createImpostors();
gameState = 'playing';
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++;
}
}
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 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
@@ -27,13 +27,19 @@
self.changeDirectionTimer = 0;
self.isIdentified = false;
self.update = function () {
if (self.isIdentified) return;
- // Change direction occasionally
- self.changeDirectionTimer++;
- if (self.changeDirectionTimer > 60 + Math.random() * 120) {
- self.direction = Math.random() * Math.PI * 2;
- self.changeDirectionTimer = 0;
+ // 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;
@@ -180,9 +186,9 @@
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 = 3 + roundNumber * 0.5;
+ impostor.speed = 4 + roundNumber * 0.8;
impostors.push(impostor);
}
}
// Initialize first round