User prompt
When impostor caught me, add %20 change dodge it,when i dodge the impostor change the text to dodged! For a second
User prompt
Make impostor 2x bigger and add,left and right turning logic based on the move direction both imp and player ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the button a bit taller and makethe door dont be covered by the text,put it a bit down
User prompt
Counter says task %97 etc. I need to fixing generator %97 etc.
User prompt
Add a basic hitboxto tasks
User prompt
Dont use facekit or something just use normal hitbox
User prompt
Please fix the bug: 'Uncaught ReferenceError: facekit is not defined' in or related to this line: 'var alpha = facekit.getImageAlphaAt('task', imgX / self.sprite.width, imgY / self.sprite.height);' Line Number: 104
User prompt
Make realistic hitbox to tasks based on the texture
User prompt
Make task 3x bigger,and make the counter,not task,do fixing generator
User prompt
Dont teleport me to tasks,if im near to task and i touch it starts to being complete
User prompt
Make tasks starts to complete when touch it
User prompt
Make every task take 3 seconds
User prompt
Make impostor and me 2x slower
User prompt
When i go on a task add a counter that shows how many seconds to finish the task
User prompt
Add a logic that my character walks to where i touch
User prompt
Make a game that a charecter chases me,im trying to complete all 5 tasks tasks take 5-10 seconds(randomizeed in every task)if i finish all tasks a door will open and i will escape
User prompt
Delete this all game
User prompt
Reset this game
User prompt
Impostor must chase me and others
User prompt
Make impostor run to crewmates and kill them with 15 second cooldown
Code edit (1 edits merged)
Please save this source code
User prompt
Impostor Hunt
Initial prompt
Make me a geme like among us
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Crewmate/Impostor player class
var Player = Container.expand(function () {
var self = Container.call(this);
// Role: 'crewmate' or 'impostor'
self.role = 'crewmate';
self.isAlive = true;
self.isLocal = false; // Only one player is local (user-controlled)
self.playerId = 0; // Unique id
// Attach asset based on role
self.setRole = function (role) {
self.role = role;
if (self.sprite) {
self.removeChild(self.sprite);
}
var assetId = role === 'impostor' ? 'impostor' : 'crewmate';
self.sprite = self.attachAsset(assetId, {
anchorX: 0.5,
anchorY: 0.5
});
// Make impostor 2x bigger
if (role === 'impostor') {
self.sprite.scaleX = 2;
self.sprite.scaleY = 2;
} else {
self.sprite.scaleX = 1;
self.sprite.scaleY = 1;
}
self.facing = 1; // 1 = right, -1 = left
self.sprite.scaleX *= self.facing;
};
// Show dead body
self.showDeadBody = function () {
if (self.sprite) self.removeChild(self.sprite);
self.sprite = self.attachAsset('deadbody', {
anchorX: 0.5,
anchorY: 0.5
});
};
// For touch feedback
self.flash = function () {
LK.effects.flashObject(self, 0xffffff, 200);
};
// For movement tween
self.moveTo = function (x, y, duration) {
tween(self, {
x: x,
y: y
}, {
duration: duration || 200,
easing: tween.easeInOut
});
};
// For kill animation
self.kill = function () {
self.isAlive = false;
self.showDeadBody();
tween(self, {
alpha: 0.7
}, {
duration: 400
});
};
// For respawn (not used in MVP)
self.respawn = function () {
self.isAlive = true;
self.setRole(self.role);
self.alpha = 1;
};
// Set initial role
self.setRole('crewmate');
return self;
});
// Task class
var Task = Container.expand(function () {
var self = Container.call(this);
self.completed = false;
self.taskId = 0;
self.sprite = self.attachAsset('task', {
anchorX: 0.5,
anchorY: 0.5
});
// Mark as completed
self.complete = function () {
self.completed = true;
tween(self.sprite, {
alpha: 0.3
}, {
duration: 300
});
};
return self;
});
// Button class (for tasks and emergency)
var UIButton = Container.expand(function () {
var self = Container.call(this);
self.label = '';
self.onPress = null;
self.type = 'button'; // 'button' or 'emergency'
self.bg = self.attachAsset('button', {
anchorX: 0.5,
anchorY: 0.5
});
self.text = new Text2('', {
size: 60,
fill: 0x222222
});
self.text.anchor.set(0.5, 0.5);
self.addChild(self.text);
self.setType = function (type) {
self.type = type;
if (type === 'emergency') {
self.removeChild(self.bg);
self.bg = self.attachAsset('emergency', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChildAt(self.bg, 0);
}
};
self.setLabel = function (label) {
self.label = label;
self.text.setText(label);
};
// Touch event
self.down = function (x, y, obj) {
if (self.onPress && typeof self.onPress === 'function') {
self.onPress();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x222b38
});
/****
* Game Code
****/
// --- GAME STATE ---
var player; // The local player (user)
var impostor; // The AI chasing impostor
var tasks = []; // All task objects
var completedTasks = 0;
var totalTasks = 5;
var taskTimers = []; // Timers for each task
var taskInProgress = null; // Currently active task
var taskProgressBar = null; // Progress bar UI
var escapeDoor = null; // Door object
var doorOpen = false;
var escapeText = null;
var gameEnded = false;
// --- LAYOUT CONSTANTS ---
var margin = 200;
var playWidth = 2048;
var playHeight = 2732;
// --- UTILS ---
function randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// --- SETUP PLAYER ---
player = new Player();
player.isLocal = true;
player.x = playWidth / 2;
player.y = playHeight - 400;
player.setRole('crewmate');
game.addChild(player);
// --- SETUP IMPOSTOR ---
impostor = new Player();
impostor.setRole('impostor');
impostor.x = playWidth / 2;
impostor.y = 400;
impostor.isLocal = false;
impostor.isAlive = true;
game.addChild(impostor);
// --- SETUP TASKS ---
tasks = [];
for (var i = 0; i < totalTasks; ++i) {
var t = new Task();
t.taskId = i;
// Place tasks in a circle around the center
var angle = i / totalTasks * Math.PI * 2;
var radius = 700;
t.x = playWidth / 2 + Math.cos(angle) * radius;
t.y = playHeight / 2 + Math.sin(angle) * radius;
t.completed = false;
t.interactive = true;
t.down = function (task) {
return function (x, y, obj) {
if (gameEnded) return;
if (task.completed) return;
if (taskInProgress) return; // Only one at a time
// Move player instantly to the task if not close enough
var dx = player.x - task.x;
var dy = player.y - task.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist > 180) {
// Too far, do not start task
LK.effects.flashObject(player, 0xff0000, 200);
return;
}
startTask(task);
};
}(t);
game.addChild(t);
tasks.push(t);
}
// --- SETUP ESCAPE DOOR (hidden until all tasks complete) ---
escapeDoor = LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5
});
escapeDoor.width = 220;
escapeDoor.height = 300; // Make the button taller
escapeDoor.x = playWidth / 2;
escapeDoor.y = margin + 120; // Move the door further down
escapeDoor.visible = false;
game.addChild(escapeDoor);
// --- ESCAPE TEXT ---
escapeText = new Text2('ESCAPE!', {
size: 90,
fill: 0xFFFFFF
});
escapeText.anchor.set(0.5, 0.5);
escapeText.x = escapeDoor.x;
escapeText.y = escapeDoor.y - 110; // Place text above the door
escapeText.visible = false;
game.addChild(escapeText);
// --- TASK PROGRESS BAR (GUI) ---
taskProgressBar = new Text2('', {
size: 80,
fill: 0xF7E85C
});
taskProgressBar.anchor.set(0.5, 0);
LK.gui.top.addChild(taskProgressBar);
// --- UPDATE TASK PROGRESS BAR ---
function updateTaskProgressBar() {
taskProgressBar.setText("Tasks: " + completedTasks + "/" + totalTasks);
}
updateTaskProgressBar();
// --- TASK LOGIC ---
function startTask(task) {
if (gameEnded) return;
taskInProgress = task;
var duration = 3000; // 3 seconds
var startTime = Date.now();
var progressText = new Text2('Fixing generator...', {
size: 80,
fill: 0xF7E85C
});
progressText.anchor.set(0.5, 0.5);
progressText.x = playWidth / 2;
progressText.y = playHeight / 2;
game.addChild(progressText);
// Add a countdown timer text
var countdownText = new Text2('', {
size: 100,
fill: 0xffffff
});
countdownText.anchor.set(0.5, 0);
countdownText.x = playWidth / 2;
countdownText.y = playHeight / 2 + 100;
game.addChild(countdownText);
// Progress bar update
var interval = LK.setInterval(function () {
var elapsed = Date.now() - startTime;
var pct = Math.min(1, elapsed / duration);
var secondsLeft = Math.ceil((duration - elapsed) / 1000);
if (secondsLeft < 0) secondsLeft = 0;
progressText.setText("Fixing generator: " + Math.round(pct * 100) + "%");
countdownText.setText("Time left: " + secondsLeft + "s");
// If player moves too far, cancel
var dx = player.x - task.x;
var dy = player.y - task.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist > 220) {
LK.clearInterval(interval);
game.removeChild(progressText);
game.removeChild(countdownText);
taskInProgress = null;
LK.effects.flashObject(player, 0xff0000, 200);
}
if (pct >= 1) {
LK.clearInterval(interval);
game.removeChild(progressText);
game.removeChild(countdownText);
completeTask(task);
taskInProgress = null;
}
}, 100);
taskTimers[task.taskId] = interval;
}
function completeTask(task) {
if (task.completed) return;
task.complete();
completedTasks++;
updateTaskProgressBar();
if (completedTasks >= totalTasks) {
openEscapeDoor();
}
}
// --- ESCAPE DOOR LOGIC ---
function openEscapeDoor() {
doorOpen = true;
escapeDoor.visible = true;
escapeText.visible = true;
LK.effects.flashObject(escapeDoor, 0x00ff00, 800);
}
// --- PLAYER ESCAPE LOGIC ---
function checkPlayerEscape() {
if (!doorOpen || gameEnded) return;
// If player is close to door, escape!
var dx = player.x - escapeDoor.x;
var dy = player.y - escapeDoor.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist < 120) {
gameEnded = true;
escapeText.setText("You Escaped!");
LK.effects.flashScreen(0x00ff00, 1200);
LK.setTimeout(function () {
LK.showYouWin();
}, 1200);
}
}
// --- IMPOSTOR AI LOGIC ---
impostor.lastX = impostor.x;
impostor.lastY = impostor.y;
impostor.speed = 3.5;
impostor.killCooldown = 0;
impostor.killDelay = 1500; // ms
function updateImpostorAI() {
if (!impostor.isAlive || !player.isAlive || gameEnded) return;
// Chase player
var dx = player.x - impostor.x;
var dy = player.y - impostor.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist > 10) {
var step = Math.min(impostor.speed, dist);
var prevX = impostor.x;
impostor.x += dx / dist * step;
impostor.y += dy / dist * step;
// Turning logic: face right if moving right, left if moving left
var moveDir = impostor.x - prevX;
if (moveDir !== 0) {
var newFacing = moveDir > 0 ? 1 : -1;
if (impostor.facing !== newFacing) {
impostor.facing = newFacing;
if (impostor.sprite) {
impostor.sprite.scaleX = Math.abs(impostor.sprite.scaleX) * impostor.facing;
}
}
}
}
// Kill if close and cooldown expired
if (dist < 120 && impostor.killCooldown <= 0 && player.isAlive) {
impostor.killCooldown = impostor.killDelay;
killPlayer();
}
if (impostor.killCooldown > 0) {
impostor.killCooldown -= 1000 / 60;
if (impostor.killCooldown < 0) impostor.killCooldown = 0;
}
impostor.lastX = impostor.x;
impostor.lastY = impostor.y;
}
// --- KILL PLAYER ---
function killPlayer() {
if (!player.isAlive || gameEnded) return;
// 20% chance to dodge
if (Math.random() < 0.2) {
// Dodged!
escapeText.setText("Dodged!");
escapeText.visible = true;
LK.effects.flashObject(player, 0x00ff00, 400);
// Hide text after 1 second
LK.setTimeout(function () {
if (!gameEnded) escapeText.visible = false;
}, 1000);
return;
}
player.kill();
gameEnded = true;
escapeText.setText("You were caught!");
escapeText.visible = true;
LK.effects.flashScreen(0xff0000, 1200);
LK.setTimeout(function () {
LK.showGameOver();
}, 1200);
}
// --- PLAYER MOVEMENT (TAP TO WALK) ---
var playerTarget = null;
var playerMoveSpeed = 8; // px per frame
game.down = function (x, y, obj) {
if (gameEnded) return;
// Set target position to where user touched, clamped to play area
var tx = Math.max(margin, Math.min(playWidth - margin, x));
var ty = Math.max(margin, Math.min(playHeight - margin, y));
playerTarget = {
x: tx,
y: ty
};
};
game.up = function (x, y, obj) {
// No-op for tap-to-move
};
game.move = function (x, y, obj) {
// No-op for tap-to-move
};
// Move player toward target in game.update
// --- ESCAPE DOOR INTERACTION ---
escapeDoor.interactive = true;
escapeDoor.down = function (x, y, obj) {
if (gameEnded) return;
checkPlayerEscape();
};
// --- MAIN GAME LOOP ---
game.update = function () {
if (gameEnded) return;
// --- PLAYER TAP-TO-MOVE LOGIC ---
if (playerTarget && player.isAlive) {
var dx = playerTarget.x - player.x;
var dy = playerTarget.y - player.y;
var dist = Math.sqrt(dx * dx + dy * dy);
var prevX = player.x;
if (dist > playerMoveSpeed) {
player.x += dx / dist * playerMoveSpeed;
player.y += dy / dist * playerMoveSpeed;
} else {
player.x = playerTarget.x;
player.y = playerTarget.y;
playerTarget = null;
}
// Turning logic: face right if moving right, left if moving left
var moveDir = player.x - prevX;
if (moveDir !== 0) {
var newFacing = moveDir > 0 ? 1 : -1;
if (player.facing !== newFacing) {
player.facing = newFacing;
if (player.sprite) {
player.sprite.scaleX = Math.abs(player.sprite.scaleX) * player.facing;
}
}
}
}
updateImpostorAI();
checkPlayerEscape();
}; ===================================================================
--- original.js
+++ change.js
@@ -376,8 +376,20 @@
}
// --- KILL PLAYER ---
function killPlayer() {
if (!player.isAlive || gameEnded) return;
+ // 20% chance to dodge
+ if (Math.random() < 0.2) {
+ // Dodged!
+ escapeText.setText("Dodged!");
+ escapeText.visible = true;
+ LK.effects.flashObject(player, 0x00ff00, 400);
+ // Hide text after 1 second
+ LK.setTimeout(function () {
+ if (!gameEnded) escapeText.visible = false;
+ }, 1000);
+ return;
+ }
player.kill();
gameEnded = true;
escapeText.setText("You were caught!");
escapeText.visible = true;
Wooden door. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat,sharp edges,straight lines,creepy and bloody look
A skull head holding a knife . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat.dark,bloody look on knife and head,make my drawing better
A scared man,make my drawing better . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat.only head,make hands as a circle.dont add body
Cabinet,metal,bloody look,sharp edges. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Fullscreen modern App Store landscape banner, 16:9, high definition, for a game titled "die by moonlight" and with the description "A game where player fix generators and tries to escape killer.". No text on banner,put the name on the up-left corner