User prompt
Optimiza y soluciona errores para poder entrar a mi juego
User prompt
Optimiza soluciona errores
User prompt
Al boss le daré un nuevo ataque, y es que aparezca varias advertencias y aparezca un rayo lanzado por el jefe por 3 segundos, cuando el jefe esté a poca vida sucede esto, y también dale una textura a las balas qué dispara el player y una textura a los ataques del boss, y una textura a la pistola, y cuando el boss muera te de un arma que dispare 2 proyectiles, y que sus balas sean 6, y que tenga recarga ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Pero dale textura cuando se seleccione el muro o valla y también textura al botón cuando se selecciona una trampa, también una textura a los personajes al médico y al enginner
User prompt
Añadele textura a todos los botones al mando, la barra de vida del player y textura a cada botón y personaje, también una textura al boss
User prompt
Soluciona los errores optimiza y haz lo que te dije ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Chat al mando dale una textura y también dale una textura al jefe y también en el menú principal dale una textura a los botones, y textura a la barra de vida del player, y también dale una textura única a cada personaje, al médico y enginner
User prompt
Reduce el lag porque siempre en la noche 3 da muchísimo lag da tanto, y hazle una animación a los monstruos de correr y al player también, y que los proyectiles de balas que dispara el player qué sean más grandes que están muy pequeños, y que no aparezcan monstruos cuando esta el boss, solo cuando el boss tiene alguna habilidad de crear monstruos aparecen ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que los monstruos corruptos cuando mueran se queden tirados en el suelo y desaparezcan en 2 segundos, y que no puedan seguir al player ni hacerle daño hasta que desaparezcan, y también añadele dos fondos, el primer fondo es en el día un fondo verde con pasto, y el otro es en la noche, un fondo verde oscuro y el pasto morado oscuro ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ahora en el boss, que la noche no se pase hasta matar al boss, y que tenga una barra de vida arriba, y añadele un ataque donde aparezca un símbolo de exclamacion (!) que indica que allí el boss atacara y que el boss ataque donde esta ese lugar, y que el boss aparezca en el medio, y que no se pueda mover solo hacer sus ataques ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que aparezca que al presionar un personaje o player tenga un respectivo color, por ejemplo el médico verde, el enginner azul y el warrior normal, cuando el warrior este apunto de morir qué tenga 30 de vida, active su modo berserk, que le otorga más velocidad que los enemigos se muevan lento, y más fuerza, con el medico que cuando este apunto de morir 30 de vida, su vida se restaure a 50 solo se puede usar una vez. Y que lance bombas que aturde al enemigo, y causan explosiones, y cuando tenga 30 de vida el enginner, el enginner qué le de más velocidad y que sus proyectiles sean más grandes. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Reduce la cantidad de monstruos que la inicio haigan 6 y ya después tus le aumentas la cantidad, y que en cada noche se aumente el tiempo de la noche, y que haiga una animación de correr y otra animación al matar un enemigo, y el botón de curar que no esté en el medio a un lado para que no moleste ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Para saber si seleccionaste ese personaje que cambie la apariencia, y para usar la habilidad del personaje médico que al pasar una noche aparezca un botón que diga curar y que cure 10 de vida, también que los personajes al disparar aparezca una pistola en la dirección donde se disparo en la mano del personaje ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ahora en el menú de personajes, que al presionar un personaje ese se seleccione para la partida, y que para matar un corrupto Swarm sea de un disparo, y para matar un corrupto scout sea de 2 tiros, y un corrupto tank sea de 3 tiros
User prompt
A partir de la noche 3 hay muchísimo lag reduce el lag, y también que haiga un menú principal donde aparezcan 2 botones, jugar y personajes, en el botón d e personajes que te lleve a otro menú donde estén 3 personajes, el primero que es el player principal, que haga un 30% más de daño, el segundo player o personaje, que se pueda curar un 10 de vida por cada noche, y el último personaje o player, que te permita que haiga un 20% menos de costo al comprar algún muro o algo así ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Ahora quita todos los botones y remplaza los por un mando
User prompt
Haz que los monstruos sean más grandes y los botones con su distancia también, y también que cuando se presione un botón y se mantenga presionado el player no pare de correr hasta que el botón deje de ser presionado
User prompt
Pero que los monstruos no puedan atravesar las vallas o muros a menos de que lo destruyan, y los botones hazlos GRANDES
User prompt
Arregla los errores y haz lo que te dije
User prompt
Si un monstruo golpea 3 veces una valla o muro se destruya, el monstruo cada dos segundos golpea, solo cuando esta cerca el player o ve un muro, y que cada noche aparezcan un poco más de enemigos
User prompt
Que al disparar 5 balas, ya no se pueda disparar y tiene que esperar 3 segundos para que se recargue el arma y pueda volver a disparar
User prompt
Pero que espere un segundo, y ya se pueda colocar objetos, que aparezca un contador en la pantalla, y disparar y esas cosas
User prompt
Al presionar un botón, se anule poner objetos, y cuando se deje de presionar se pueda colocar objetos
User prompt
Y que aigan más monedas
User prompt
Pero que los monstruos la pistola los mate de un disparo y que no aigan tantos monstruos
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Boss = Container.expand(function () {
var self = Container.call(this);
var bossGraphics = self.attachAsset('corruptedTank', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.5,
scaleY: 2.5
});
bossGraphics.tint = 0x4a0080; // Darker purple for boss
self.health = 20;
self.maxHealth = 20;
self.speed = 0.5;
self.damage = 30;
self.type = 'boss';
self.spawnTimer = 0;
self.targetX = 1024;
self.targetY = 1366;
self.update = function () {
// Boss movement
var dx = self.targetX - self.x;
var dy = self.targetY - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 5) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
}
// Spawn zombies every 10 seconds (600 frames at 60fps)
self.spawnTimer++;
if (self.spawnTimer >= 600) {
self.spawnTimer = 0;
// Spawn a zombie near the boss
var zombie = new CorruptedScout();
zombie.x = self.x + (Math.random() - 0.5) * 200;
zombie.y = self.y + (Math.random() - 0.5) * 200;
zombie.health = 15; // Weaker zombies
monsters.push(zombie);
game.addChild(zombie);
}
};
self.takeDamage = function (damage) {
self.health -= damage;
LK.effects.flashObject(self, 0xff0000, 200);
if (self.health <= 0) {
return true;
}
return false;
};
return self;
});
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('resource', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.3,
scaleY: 0.3
});
bulletGraphics.tint = 0xffff00; // Yellow bullets
self.speed = 8;
self.damage = 1;
self.type = 'bullet';
self.direction = {
x: 0,
y: 0
};
self.update = function () {
self.x += self.direction.x * self.speed;
self.y += self.direction.y * self.speed;
// Remove bullet if it goes off screen
if (self.x < -50 || self.x > 2098 || self.y < -50 || self.y > 2782) {
self.destroy();
for (var i = bullets.length - 1; i >= 0; i--) {
if (bullets[i] === self) {
bullets.splice(i, 1);
break;
}
}
}
};
return self;
});
var CorruptedScout = Container.expand(function () {
var self = Container.call(this);
var scoutGraphics = self.attachAsset('corruptedScout', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 1;
self.maxHealth = 1;
self.speed = 2;
self.damage = 10;
self.type = 'scout';
self.update = function () {
// Always pursue the player
var dx = player.x - self.x;
var dy = player.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 5) {
// Calculate intended next position
var nextX = self.x + dx / distance * self.speed;
var nextY = self.y + dy / distance * self.speed;
var blocked = false;
for (var i = 0; i < walls.length; i++) {
var wall = walls[i];
if (wall.health > 0) {
// Simulate monster at next position
var tempDist = Math.sqrt((nextX - wall.x) * (nextX - wall.x) + (nextY - wall.y) * (nextY - wall.y));
if (tempDist < 50) {
blocked = true;
break;
}
}
}
if (!blocked) {
self.x = nextX;
self.y = nextY;
}
}
};
self.takeDamage = function (damage) {
self.health -= damage;
if (self.health <= 0) {
return true;
}
return false;
};
return self;
});
var CorruptedSwarm = Container.expand(function () {
var self = Container.call(this);
var swarmGraphics = self.attachAsset('corruptedSwarm', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 1;
self.maxHealth = 1;
self.speed = 3;
self.damage = 5;
self.type = 'swarm';
self.update = function () {
// Always pursue the player
var dx = player.x - self.x;
var dy = player.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 5) {
// Calculate intended next position
var nextX = self.x + dx / distance * self.speed;
var nextY = self.y + dy / distance * self.speed;
var blocked = false;
for (var i = 0; i < walls.length; i++) {
var wall = walls[i];
if (wall.health > 0) {
var tempDist = Math.sqrt((nextX - wall.x) * (nextX - wall.x) + (nextY - wall.y) * (nextY - wall.y));
if (tempDist < 50) {
blocked = true;
break;
}
}
}
if (!blocked) {
self.x = nextX;
self.y = nextY;
}
}
};
self.takeDamage = function (damage) {
self.health -= damage;
if (self.health <= 0) {
return true;
}
return false;
};
return self;
});
var CorruptedTank = Container.expand(function () {
var self = Container.call(this);
var tankGraphics = self.attachAsset('corruptedTank', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 1;
self.maxHealth = 1;
self.speed = 1;
self.damage = 25;
self.type = 'tank';
self.update = function () {
// Always pursue the player
var dx = player.x - self.x;
var dy = player.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 5) {
// Calculate intended next position
var nextX = self.x + dx / distance * self.speed;
var nextY = self.y + dy / distance * self.speed;
var blocked = false;
for (var i = 0; i < walls.length; i++) {
var wall = walls[i];
if (wall.health > 0) {
var tempDist = Math.sqrt((nextX - wall.x) * (nextX - wall.x) + (nextY - wall.y) * (nextY - wall.y));
if (tempDist < 50) {
blocked = true;
break;
}
}
}
if (!blocked) {
self.x = nextX;
self.y = nextY;
}
}
};
self.takeDamage = function (damage) {
self.health -= damage;
if (self.health <= 0) {
return true;
}
return false;
};
return self;
});
var Resource = Container.expand(function () {
var self = Container.call(this);
var resourceGraphics = self.attachAsset('resource', {
anchorX: 0.5,
anchorY: 0.5
});
self.value = 10;
self.type = 'resource';
self.update = function () {
self.rotation += 0.05;
};
return self;
});
var Trap = Container.expand(function () {
var self = Container.call(this);
var trapGraphics = self.attachAsset('trap', {
anchorX: 0.5,
anchorY: 0.5
});
self.damage = 30;
self.cooldown = 0;
self.type = 'trap';
self.update = function () {
if (self.cooldown > 0) {
self.cooldown--;
}
};
self.activate = function () {
if (self.cooldown <= 0) {
self.cooldown = 60;
LK.effects.flashObject(self, 0xff6b35, 300);
return self.damage;
}
return 0;
};
return self;
});
var Wall = Container.expand(function () {
var self = Container.call(this);
var wallGraphics = self.attachAsset('wall', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 100;
self.maxHealth = 100;
self.type = 'wall';
// Track monster hits
self.hitCount = 0;
self.lastMonsterHitTick = 0; // LK.ticks of last monster hit
self.takeDamage = function (damage) {
self.health -= damage;
if (self.health <= 0) {
self.health = 0;
wallGraphics.alpha = 0.3;
} else {
wallGraphics.alpha = 0.5 + self.health / self.maxHealth * 0.5;
}
};
self.registerMonsterHit = function () {
self.hitCount++;
self.lastMonsterHitTick = LK.ticks;
if (self.hitCount >= 3) {
self.health = 0;
wallGraphics.alpha = 0.3;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a2e
});
/****
* Game Code
****/
var gameState = 'platform_select'; // Start with platform selection
var platform = null; // Will be 'mobile' or 'pc'
var currentNight = 0;
var dayTimer = 1800; // 30 seconds at 60fps
var nightTimer = 0;
var playerHealth = 100;
var playerResources = 50;
var selectedDefense = 'wall';
var walls = [];
var traps = [];
var resources = [];
var monsters = [];
var boss = null;
var bullets = [];
var playerPistol = true; // Player has pistol
var pistolBullets = 5; // Bullets left before reload
var pistolReloading = false; // Is pistol reloading
var pistolReloadTimer = 0; // Frames left for reload (180 = 3s)
var pistolReloadText = new Text2('', {
size: 80,
fill: 0xFF0000
});
pistolReloadText.anchor.set(0.5, 0.5);
pistolReloadText.x = 0;
pistolReloadText.y = 200;
pistolReloadText.alpha = 0;
LK.gui.center.addChild(pistolReloadText);
var player = game.addChild(LK.getAsset('player', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Button visibility is now handled by the UI buttons
disablePlacement = false;
var gameStateText = new Text2('Day Phase', {
size: 80,
fill: 0xFFFFFF
});
gameStateText.anchor.set(0.5, 0);
LK.gui.top.addChild(gameStateText);
var timerText = new Text2('30s', {
size: 60,
fill: 0xFFFF00
});
timerText.anchor.set(0.5, 0);
timerText.y = 100;
LK.gui.top.addChild(timerText);
var healthText = new Text2('Health: 100', {
size: 50,
fill: 0xFF0000
});
healthText.anchor.set(0, 0);
LK.gui.topLeft.addChild(healthText);
healthText.x = 120;
var resourceText = new Text2('Resources: 50', {
size: 50,
fill: 0xFFD700
});
resourceText.anchor.set(0, 0);
resourceText.y = 60;
LK.gui.topLeft.addChild(resourceText);
resourceText.x = 120;
var nightText = new Text2('Night: 0', {
size: 50,
fill: 0x8B3A8B
});
nightText.anchor.set(1, 0);
LK.gui.topRight.addChild(nightText);
// Platform selection UI
var platformTitle = new Text2('Select Your Platform', {
size: 100,
fill: 0xFFFFFF
});
platformTitle.anchor.set(0.5, 0.5);
platformTitle.x = 0;
platformTitle.y = -200;
LK.gui.center.addChild(platformTitle);
var mobileButton = LK.getAsset('player', {
anchorX: 0.5,
anchorY: 0.5,
x: -200,
y: 0,
scaleX: 2,
scaleY: 2
});
LK.gui.center.addChild(mobileButton);
var pcButton = LK.getAsset('player', {
anchorX: 0.5,
anchorY: 0.5,
x: 200,
y: 0,
scaleX: 2,
scaleY: 2
});
LK.gui.center.addChild(pcButton);
var mobileText = new Text2('MOBILE', {
size: 80,
fill: 0x00FF00
});
mobileText.anchor.set(0.5, 0.5);
mobileText.x = -200;
mobileText.y = 120;
LK.gui.center.addChild(mobileText);
var pcText = new Text2('PC', {
size: 80,
fill: 0x00FF00
});
pcText.anchor.set(0.5, 0.5);
pcText.x = 200;
pcText.y = 120;
LK.gui.center.addChild(pcText);
var instructionText = new Text2('Choose your platform to optimize controls', {
size: 50,
fill: 0xFFFFFF
});
instructionText.anchor.set(0.5, 0.5);
instructionText.x = 0;
instructionText.y = 250;
LK.gui.center.addChild(instructionText);
var defenseText = new Text2('Defense: Wall (Cost: 10)', {
size: 40,
fill: 0xFFFFFF
});
defenseText.anchor.set(0.5, 1);
defenseText.y = -120;
defenseText.alpha = 0;
LK.gui.bottom.addChild(defenseText);
// Mobile UI Buttons (initially hidden)
var wallButton = LK.getAsset('wall', {
anchorX: 0.5,
anchorY: 0.5,
x: -350,
y: -120,
scaleX: 3.5,
scaleY: 3.5
});
wallButton.alpha = 0;
LK.gui.bottom.addChild(wallButton);
var trapButton = LK.getAsset('trap', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -120,
scaleX: 3.5,
scaleY: 3.5
});
trapButton.alpha = 0;
LK.gui.bottom.addChild(trapButton);
var collectButton = LK.getAsset('resource', {
anchorX: 0.5,
anchorY: 0.5,
x: 350,
y: -120,
scaleX: 3.5,
scaleY: 3.5
});
collectButton.alpha = 0;
LK.gui.bottom.addChild(collectButton);
var wallButtonText = new Text2('Wall\n10R', {
size: 60,
fill: 0xFFFFFF
});
wallButtonText.anchor.set(0.5, 0.5);
wallButtonText.x = -350;
wallButtonText.y = 40;
wallButtonText.alpha = 0;
LK.gui.bottom.addChild(wallButtonText);
var trapButtonText = new Text2('Trap\n15R', {
size: 60,
fill: 0xFFFFFF
});
trapButtonText.anchor.set(0.5, 0.5);
trapButtonText.x = 0;
trapButtonText.y = 40;
trapButtonText.alpha = 0;
LK.gui.bottom.addChild(trapButtonText);
var collectButtonText = new Text2('Collect\nMode', {
size: 60,
fill: 0xFFFFFF
});
collectButtonText.anchor.set(0.5, 0.5);
collectButtonText.x = 350;
collectButtonText.y = 40;
collectButtonText.alpha = 0;
LK.gui.bottom.addChild(collectButtonText);
// Button selection indicator
var buttonIndicator = LK.getAsset('wall', {
anchorX: 0.5,
anchorY: 0.5,
x: -350,
y: -120,
scaleX: 4.0,
scaleY: 4.0
});
buttonIndicator.alpha = 0;
LK.gui.bottom.addChild(buttonIndicator);
// Mobile movement buttons (initially hidden) - positioned in bottom-left corner
var upButton = LK.getAsset('moveButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 300,
y: -500,
scaleX: 3.5,
scaleY: 3.5
});
upButton.alpha = 0;
LK.gui.bottomLeft.addChild(upButton);
var downButton = LK.getAsset('moveButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 300,
y: -100,
scaleX: 3.5,
scaleY: 3.5
});
downButton.alpha = 0;
LK.gui.bottomLeft.addChild(downButton);
var leftButton = LK.getAsset('moveButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 50,
y: -300,
scaleX: 3.5,
scaleY: 3.5
});
leftButton.alpha = 0;
LK.gui.bottomLeft.addChild(leftButton);
var rightButton = LK.getAsset('moveButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 550,
y: -300,
scaleX: 3.5,
scaleY: 3.5
});
rightButton.alpha = 0;
LK.gui.bottomLeft.addChild(rightButton);
// Movement button text labels
var upButtonText = new Text2('↑', {
size: 120,
fill: 0xFFFFFF
});
upButtonText.anchor.set(0.5, 0.5);
upButtonText.x = 300;
upButtonText.y = -500;
upButtonText.alpha = 0;
LK.gui.bottomLeft.addChild(upButtonText);
var downButtonText = new Text2('↓', {
size: 120,
fill: 0xFFFFFF
});
downButtonText.anchor.set(0.5, 0.5);
downButtonText.x = 300;
downButtonText.y = -100;
downButtonText.alpha = 0;
LK.gui.bottomLeft.addChild(downButtonText);
var leftButtonText = new Text2('←', {
size: 120,
fill: 0xFFFFFF
});
leftButtonText.anchor.set(0.5, 0.5);
leftButtonText.x = 50;
leftButtonText.y = -300;
leftButtonText.alpha = 0;
LK.gui.bottomLeft.addChild(leftButtonText);
var rightButtonText = new Text2('→', {
size: 120,
fill: 0xFFFFFF
});
rightButtonText.anchor.set(0.5, 0.5);
rightButtonText.x = 550;
rightButtonText.y = -300;
rightButtonText.alpha = 0;
LK.gui.bottomLeft.addChild(rightButtonText);
// Game mode state
var gameMode = 'build'; // 'build' or 'collect'
var disablePlacement = false; // Prevents placing objects while a button is pressed
var buttonHeld = {
up: false,
down: false,
left: false,
right: false
};
var placementCooldown = 0; // Frames left for placement cooldown (60 = 1s)
var placementCooldownText = new Text2('', {
size: 80,
fill: 0xFF0000
});
placementCooldownText.anchor.set(0.5, 0.5);
placementCooldownText.x = 0;
placementCooldownText.y = 0;
placementCooldownText.alpha = 0;
LK.gui.center.addChild(placementCooldownText);
// Spawn initial resources
for (var i = 0; i < 18; i++) {
var resource = new Resource();
resource.x = 200 + Math.random() * 1648;
resource.y = 200 + Math.random() * 1200;
resources.push(resource);
game.addChild(resource);
}
function spawnMonster(type) {
var monster;
switch (type) {
case 'scout':
monster = new CorruptedScout();
break;
case 'tank':
monster = new CorruptedTank();
break;
case 'swarm':
monster = new CorruptedSwarm();
break;
default:
monster = new CorruptedScout();
}
// Spawn from edges
var side = Math.floor(Math.random() * 4);
switch (side) {
case 0:
// Top
monster.x = Math.random() * 2048;
monster.y = -50;
break;
case 1:
// Right
monster.x = 2098;
monster.y = Math.random() * 2732;
break;
case 2:
// Bottom
monster.x = Math.random() * 2048;
monster.y = 2782;
break;
case 3:
// Left
monster.x = -50;
monster.y = Math.random() * 2732;
break;
}
monsters.push(monster);
game.addChild(monster);
}
function switchToNight() {
gameState = 'night';
currentNight++;
nightTimer = 1800; // 30 seconds
gameStateText.setText('Night ' + currentNight);
timerText.setText('30s');
nightText.setText('Night: ' + currentNight);
game.setBackgroundColor(0x0f0f23);
LK.playMusic('nightfall');
// Hide UI buttons during night
wallButton.alpha = 0.3;
trapButton.alpha = 0.3;
collectButton.alpha = 0.3;
buttonIndicator.alpha = 0.1;
defenseText.setText('Night Phase - Survive!');
// Spawn initial monsters for the night
var initialMonsters = 4 + Math.floor(currentNight * 1.2); // Increase monsters each night (more than before)
for (var i = 0; i < initialMonsters; i++) {
spawnMonster('scout'); // Start with scouts for the initial wave
}
// Spawn boss every 3rd night
if (currentNight % 3 === 0 && boss === null) {
boss = new Boss();
// Spawn boss from a random edge
var side = Math.floor(Math.random() * 4);
switch (side) {
case 0:
// Top
boss.x = Math.random() * 2048;
boss.y = -100;
break;
case 1:
// Right
boss.x = 2148;
boss.y = Math.random() * 2732;
break;
case 2:
// Bottom
boss.x = Math.random() * 2048;
boss.y = 2832;
break;
case 3:
// Left
boss.x = -100;
boss.y = Math.random() * 2732;
break;
}
game.addChild(boss);
}
}
function switchToDay() {
gameState = 'day';
dayTimer = 1800; // 30 seconds
gameStateText.setText('Day Phase');
timerText.setText('30s');
game.setBackgroundColor(0x1a1a2e);
LK.stopMusic();
// Show UI buttons during day
wallButton.alpha = 1.0;
trapButton.alpha = 1.0;
collectButton.alpha = 1.0;
buttonIndicator.alpha = 0.3;
// Reset to default mode
gameMode = 'build';
selectedDefense = 'wall';
defenseText.setText('Defense: Wall (Cost: 10)');
buttonIndicator.x = -350;
wallButtonText.tint = 0x00FF00;
trapButtonText.tint = 0xFFFFFF;
collectButtonText.tint = 0xFFFFFF;
// Spawn new resources
for (var i = 0; i < 12; i++) {
var resource = new Resource();
resource.x = 200 + Math.random() * 1648;
resource.y = 200 + Math.random() * 1200;
resources.push(resource);
game.addChild(resource);
}
}
// Platform selection button handlers
mobileButton.down = function (x, y, obj) {
if (gameState === 'platform_select') {
platform = 'mobile';
startGame();
}
};
pcButton.down = function (x, y, obj) {
if (gameState === 'platform_select') {
platform = 'pc';
startGame();
}
};
function startGame() {
// Hide platform selection UI
platformTitle.alpha = 0;
mobileButton.alpha = 0;
pcButton.alpha = 0;
mobileText.alpha = 0;
pcText.alpha = 0;
instructionText.alpha = 0;
// Configure UI based on platform
if (platform === 'mobile') {
// Show mobile UI buttons
wallButton.alpha = 1.0;
trapButton.alpha = 1.0;
collectButton.alpha = 1.0;
buttonIndicator.alpha = 0.3;
wallButtonText.alpha = 1.0;
trapButtonText.alpha = 1.0;
collectButtonText.alpha = 1.0;
defenseText.alpha = 1.0;
// Show movement buttons
upButton.alpha = 1.0;
downButton.alpha = 1.0;
leftButton.alpha = 1.0;
rightButton.alpha = 1.0;
upButtonText.alpha = 1.0;
downButtonText.alpha = 1.0;
leftButtonText.alpha = 1.0;
rightButtonText.alpha = 1.0;
} else {
// Hide mobile UI buttons for PC
wallButton.alpha = 0;
trapButton.alpha = 0;
collectButton.alpha = 0;
buttonIndicator.alpha = 0;
wallButtonText.alpha = 0;
trapButtonText.alpha = 0;
collectButtonText.alpha = 0;
defenseText.setText('Use keyboard: W=Wall, T=Trap, C=Collect');
// Hide movement buttons
upButton.alpha = 0;
downButton.alpha = 0;
leftButton.alpha = 0;
rightButton.alpha = 0;
upButtonText.alpha = 0;
downButtonText.alpha = 0;
leftButtonText.alpha = 0;
rightButtonText.alpha = 0;
}
// Start the game
gameState = 'day';
}
// Button event handlers
wallButton.down = function (x, y, obj) {
if (gameState === 'day') {
selectedDefense = 'wall';
gameMode = 'build';
defenseText.setText('Defense: Wall (Cost: 10)');
buttonIndicator.x = -350;
wallButtonText.tint = 0x00FF00;
trapButtonText.tint = 0xFFFFFF;
collectButtonText.tint = 0xFFFFFF;
}
disablePlacement = true;
placementCooldown = 60; // 1 second at 60fps
placementCooldownText.alpha = 1;
placementCooldownText.setText('1');
};
trapButton.down = function (x, y, obj) {
if (gameState === 'day') {
selectedDefense = 'trap';
gameMode = 'build';
defenseText.setText('Defense: Trap (Cost: 15)');
buttonIndicator.x = 0;
wallButtonText.tint = 0xFFFFFF;
trapButtonText.tint = 0x00FF00;
collectButtonText.tint = 0xFFFFFF;
}
disablePlacement = true;
placementCooldown = 60;
placementCooldownText.alpha = 1;
placementCooldownText.setText('1');
};
collectButton.down = function (x, y, obj) {
if (gameState === 'day') {
gameMode = 'collect';
defenseText.setText('Mode: Resource Collection');
buttonIndicator.x = 350;
wallButtonText.tint = 0xFFFFFF;
trapButtonText.tint = 0xFFFFFF;
collectButtonText.tint = 0x00FF00;
}
disablePlacement = true;
placementCooldown = 60;
placementCooldownText.alpha = 1;
placementCooldownText.setText('1');
};
// Movement button event handlers
upButton.down = function (x, y, obj) {
if (gameState !== 'platform_select') {
buttonHeld.up = true;
}
disablePlacement = true;
placementCooldown = 60;
placementCooldownText.alpha = 1;
placementCooldownText.setText('1');
};
upButton.up = function (x, y, obj) {
buttonHeld.up = false;
};
downButton.down = function (x, y, obj) {
if (gameState !== 'platform_select') {
buttonHeld.down = true;
}
disablePlacement = true;
placementCooldown = 60;
placementCooldownText.alpha = 1;
placementCooldownText.setText('1');
};
downButton.up = function (x, y, obj) {
buttonHeld.down = false;
};
leftButton.down = function (x, y, obj) {
if (gameState !== 'platform_select') {
buttonHeld.left = true;
}
disablePlacement = true;
placementCooldown = 60;
placementCooldownText.alpha = 1;
placementCooldownText.setText('1');
};
leftButton.up = function (x, y, obj) {
buttonHeld.left = false;
};
rightButton.down = function (x, y, obj) {
if (gameState !== 'platform_select') {
buttonHeld.right = true;
}
disablePlacement = true;
placementCooldown = 60;
placementCooldownText.alpha = 1;
placementCooldownText.setText('1');
};
rightButton.up = function (x, y, obj) {
buttonHeld.right = false;
};
game.down = function (x, y, obj) {
if (gameState === 'platform_select') {
return; // Don't allow interaction during platform selection
}
if (disablePlacement) {
return; // Prevent placing objects while a button is pressed
}
// Prevent placing blocks/objects if clicking on movement buttons (by hitbox)
// Only applies if platform is mobile and movement buttons are visible
if (platform === 'mobile') {
// Check if click is inside any movement button hitbox
// All movement buttons are centered at (x, y) with radius ~60 (scale 1.5 * 40)
var btns = [{
btn: upButton,
cx: upButton.x,
cy: upButton.y
}, {
btn: downButton,
cx: downButton.x,
cy: downButton.y
}, {
btn: leftButton,
cx: leftButton.x,
cy: leftButton.y
}, {
btn: rightButton,
cx: rightButton.x,
cy: rightButton.y
}];
for (var i = 0; i < btns.length; i++) {
var btn = btns[i];
// Only check if visible
if (btn.btn.alpha > 0.5) {
// Convert global (x, y) to LK.gui.bottomLeft local coordinates
var local = LK.gui.bottomLeft.toLocal({
x: x,
y: y
}, game);
var dx = local.x - btn.cx;
var dy = local.y - btn.cy;
if (dx * dx + dy * dy < 80 * 1.5 * 0.6 * 80 * 1.5 * 0.6) {
// radius ~72
return; // Click was on a movement button, do nothing
}
}
}
}
if (gameState === 'day') {
if (gameMode === 'build') {
var cost = selectedDefense === 'wall' ? 10 : 15;
if (playerResources >= cost) {
var defense;
if (selectedDefense === 'wall') {
defense = new Wall();
} else {
defense = new Trap();
}
defense.x = x;
defense.y = y;
if (selectedDefense === 'wall') {
walls.push(defense);
} else {
traps.push(defense);
}
game.addChild(defense);
playerResources -= cost;
resourceText.setText('Resources: ' + playerResources);
LK.getSound('build').play();
}
} else if (gameMode === 'collect') {
// Enhanced resource collection in collect mode
for (var i = resources.length - 1; i >= 0; i--) {
var resource = resources[i];
var dx = x - resource.x;
var dy = y - resource.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 100) {
playerResources += resource.value;
resourceText.setText('Resources: ' + playerResources);
resource.destroy();
resources.splice(i, 1);
LK.getSound('collect').play();
break;
}
}
}
} else if (gameState === 'night' && playerPistol && !pistolReloading && pistolBullets > 0) {
// Shoot bullet towards click position
var bullet = new Bullet();
bullet.x = player.x;
bullet.y = player.y;
// Calculate direction to target
var dx = x - player.x;
var dy = y - player.y;
var distance = Math.sqrt(dx * dx + dy * dy);
bullet.direction.x = dx / distance;
bullet.direction.y = dy / distance;
bullets.push(bullet);
game.addChild(bullet);
LK.getSound('shoot').play();
pistolBullets--;
if (pistolBullets === 0) {
pistolReloading = true;
pistolReloadTimer = 180; // 3 seconds at 60fps
pistolReloadText.alpha = 1;
pistolReloadText.setText('Reloading...');
}
}
};
game.up = function (x, y, obj) {
// Button visibility is now handled by the UI buttons
};
game.update = function () {
if (gameState === 'platform_select') {
return; // Don't update game during platform selection
}
// Handle continuous movement when buttons are held
if (gameState !== 'platform_select' && platform === 'mobile') {
if (buttonHeld.up) {
player.y = Math.max(50, player.y - 5);
}
if (buttonHeld.down) {
player.y = Math.min(2682, player.y + 5);
}
if (buttonHeld.left) {
player.x = Math.max(50, player.x - 5);
}
if (buttonHeld.right) {
player.x = Math.min(1998, player.x + 5);
}
}
// Handle pistol reload timer
if (pistolReloading) {
pistolReloadTimer--;
pistolReloadText.alpha = 1;
pistolReloadText.setText('Reload: ' + Math.ceil(pistolReloadTimer / 60) + 's');
if (pistolReloadTimer <= 0) {
pistolReloading = false;
pistolBullets = 5;
pistolReloadText.alpha = 0;
}
}
// Placement cooldown logic
if (placementCooldown > 0) {
placementCooldown--;
if (placementCooldown > 0) {
placementCooldownText.alpha = 1;
placementCooldownText.setText('' + Math.ceil(placementCooldown / 60));
disablePlacement = true;
} else {
placementCooldownText.alpha = 0;
disablePlacement = false;
}
}
if (gameState === 'day') {
dayTimer--;
timerText.setText(Math.ceil(dayTimer / 60) + 's');
if (dayTimer <= 0) {
switchToNight();
}
// Resource collection
for (var i = resources.length - 1; i >= 0; i--) {
var resource = resources[i];
var dx = player.x - resource.x;
var dy = player.y - resource.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 60) {
playerResources += resource.value;
resourceText.setText('Resources: ' + playerResources);
resource.destroy();
resources.splice(i, 1);
LK.getSound('collect').play();
}
}
} else if (gameState === 'night') {
nightTimer--;
timerText.setText(Math.ceil(nightTimer / 60) + 's');
// Spawn monsters
var spawnRate = 90; // Lower spawn frequency (higher value = fewer monsters)
var maxMonsters = 10 + Math.floor(currentNight * 1.2); // Increase max monsters as nights progress (more than before)
if (LK.ticks % spawnRate === 0 && monsters.length < maxMonsters) {
var monsterTypes = ['scout', 'tank', 'swarm'];
var type = monsterTypes[Math.floor(Math.random() * monsterTypes.length)];
spawnMonster(type);
}
// Monster AI and collision
for (var i = monsters.length - 1; i >= 0; i--) {
var monster = monsters[i];
// Check collision with player
var dx = player.x - monster.x;
var dy = player.y - monster.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 50) {
playerHealth -= monster.damage;
healthText.setText('Health: ' + playerHealth);
monster.destroy();
monsters.splice(i, 1);
LK.getSound('damage').play();
if (playerHealth <= 0) {
LK.showGameOver();
}
continue;
}
// Check collision with walls
var hitWall = false;
for (var j = 0; j < walls.length; j++) {
var wall = walls[j];
if (wall.health > 0 && monster.intersects(wall)) {
// Monster only attacks wall every 2 seconds (120 ticks)
// Only if player is within 300px or monster is within 300px of wall (simulate "seeing" wall)
var playerDist = Math.sqrt((player.x - monster.x) * (player.x - monster.x) + (player.y - monster.y) * (player.y - monster.y));
var wallDist = Math.sqrt((wall.x - monster.x) * (wall.x - monster.x) + (wall.y - monster.y) * (wall.y - monster.y));
if (playerDist < 300 || wallDist < 300) {
if (LK.ticks - wall.lastMonsterHitTick >= 120) {
wall.registerMonsterHit();
wall.takeDamage(monster.damage);
LK.effects.flashObject(wall, 0xff0000, 200);
// If wall is destroyed after 3 hits, set health to 0 and alpha to 0.3
if (wall.hitCount >= 3 || wall.health <= 0) {
wall.health = 0;
wall.alpha = 0.3;
}
}
}
// Monster stays and keeps attacking, do not destroy monster
hitWall = true;
break;
}
}
if (hitWall) continue;
// Check collision with traps
for (var k = 0; k < traps.length; k++) {
var trap = traps[k];
if (monster.intersects(trap)) {
var trapDamage = trap.activate();
if (trapDamage > 0) {
var isDead = monster.takeDamage(trapDamage);
if (isDead) {
LK.setScore(LK.getScore() + 10);
monster.destroy();
monsters.splice(i, 1);
break;
}
}
}
}
}
// Handle boss combat
if (boss !== null) {
// Check collision with player
var dx = player.x - boss.x;
var dy = player.y - boss.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 80) {
playerHealth -= boss.damage;
healthText.setText('Health: ' + playerHealth);
LK.getSound('damage').play();
if (playerHealth <= 0) {
LK.showGameOver();
}
// Push player away from boss
var pushDistance = 100;
var pushX = dx / distance * pushDistance;
var pushY = dy / distance * pushDistance;
player.x = Math.max(50, Math.min(1998, player.x + pushX));
player.y = Math.max(50, Math.min(2682, player.y + pushY));
}
}
// Handle bullet collisions
for (var i = bullets.length - 1; i >= 0; i--) {
var bullet = bullets[i];
var bulletHit = false;
// Check collision with monsters
for (var j = monsters.length - 1; j >= 0; j--) {
var monster = monsters[j];
var dx = bullet.x - monster.x;
var dy = bullet.y - monster.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 30) {
var isDead = monster.takeDamage(bullet.damage);
if (isDead) {
LK.setScore(LK.getScore() + 10);
monster.destroy();
monsters.splice(j, 1);
}
bullet.destroy();
bullets.splice(i, 1);
bulletHit = true;
break;
}
}
// Check collision with boss
if (!bulletHit && boss !== null) {
var dx = bullet.x - boss.x;
var dy = bullet.y - boss.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 60) {
var isBossDead = boss.takeDamage(bullet.damage);
if (isBossDead) {
LK.setScore(LK.getScore() + 100);
boss.destroy();
boss = null;
LK.effects.flashScreen(0x00ff00, 500); // Green flash for boss kill
}
bullet.destroy();
bullets.splice(i, 1);
}
}
}
if (nightTimer <= 0) {
// Clear remaining monsters
for (var m = monsters.length - 1; m >= 0; m--) {
monsters[m].destroy();
monsters.splice(m, 1);
}
// Clear remaining bullets
for (var b = bullets.length - 1; b >= 0; b--) {
bullets[b].destroy();
bullets.splice(b, 1);
}
// Clear boss if exists
if (boss !== null) {
boss.destroy();
boss = null;
}
switchToDay();
}
}
// Player-monster interaction for attacks
for (var i = monsters.length - 1; i >= 0; i--) {
var monster = monsters[i];
// Check for collision with player to trigger attack
var dx = player.x - monster.x;
var dy = player.y - monster.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 60) {
// Collision radius for attack
// Monster attacks player
playerHealth -= monster.damage;
healthText.setText('Health: ' + playerHealth);
LK.getSound('damage').play();
if (playerHealth <= 0) {
LK.showGameOver();
}
// Optionally remove monster after attack (or add cooldown)
monster.destroy();
monsters.splice(i, 1);
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -437,41 +437,41 @@
// Mobile UI Buttons (initially hidden)
var wallButton = LK.getAsset('wall', {
anchorX: 0.5,
anchorY: 0.5,
- x: -250,
+ x: -350,
y: -120,
- scaleX: 2.5,
- scaleY: 2.5
+ scaleX: 3.5,
+ scaleY: 3.5
});
wallButton.alpha = 0;
LK.gui.bottom.addChild(wallButton);
var trapButton = LK.getAsset('trap', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -120,
- scaleX: 2.5,
- scaleY: 2.5
+ scaleX: 3.5,
+ scaleY: 3.5
});
trapButton.alpha = 0;
LK.gui.bottom.addChild(trapButton);
var collectButton = LK.getAsset('resource', {
anchorX: 0.5,
anchorY: 0.5,
- x: 250,
+ x: 350,
y: -120,
- scaleX: 2.5,
- scaleY: 2.5
+ scaleX: 3.5,
+ scaleY: 3.5
});
collectButton.alpha = 0;
LK.gui.bottom.addChild(collectButton);
var wallButtonText = new Text2('Wall\n10R', {
size: 60,
fill: 0xFFFFFF
});
wallButtonText.anchor.set(0.5, 0.5);
-wallButtonText.x = -250;
+wallButtonText.x = -350;
wallButtonText.y = 40;
wallButtonText.alpha = 0;
LK.gui.bottom.addChild(wallButtonText);
var trapButtonText = new Text2('Trap\n15R', {
@@ -487,61 +487,61 @@
size: 60,
fill: 0xFFFFFF
});
collectButtonText.anchor.set(0.5, 0.5);
-collectButtonText.x = 250;
+collectButtonText.x = 350;
collectButtonText.y = 40;
collectButtonText.alpha = 0;
LK.gui.bottom.addChild(collectButtonText);
// Button selection indicator
var buttonIndicator = LK.getAsset('wall', {
anchorX: 0.5,
anchorY: 0.5,
- x: -250,
+ x: -350,
y: -120,
- scaleX: 3.0,
- scaleY: 3.0
+ scaleX: 4.0,
+ scaleY: 4.0
});
buttonIndicator.alpha = 0;
LK.gui.bottom.addChild(buttonIndicator);
// Mobile movement buttons (initially hidden) - positioned in bottom-left corner
var upButton = LK.getAsset('moveButton', {
anchorX: 0.5,
anchorY: 0.5,
- x: 200,
- y: -400,
- scaleX: 2.5,
- scaleY: 2.5
+ x: 300,
+ y: -500,
+ scaleX: 3.5,
+ scaleY: 3.5
});
upButton.alpha = 0;
LK.gui.bottomLeft.addChild(upButton);
var downButton = LK.getAsset('moveButton', {
anchorX: 0.5,
anchorY: 0.5,
- x: 200,
+ x: 300,
y: -100,
- scaleX: 2.5,
- scaleY: 2.5
+ scaleX: 3.5,
+ scaleY: 3.5
});
downButton.alpha = 0;
LK.gui.bottomLeft.addChild(downButton);
var leftButton = LK.getAsset('moveButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 50,
- y: -250,
- scaleX: 2.5,
- scaleY: 2.5
+ y: -300,
+ scaleX: 3.5,
+ scaleY: 3.5
});
leftButton.alpha = 0;
LK.gui.bottomLeft.addChild(leftButton);
var rightButton = LK.getAsset('moveButton', {
anchorX: 0.5,
anchorY: 0.5,
- x: 350,
- y: -250,
- scaleX: 2.5,
- scaleY: 2.5
+ x: 550,
+ y: -300,
+ scaleX: 3.5,
+ scaleY: 3.5
});
rightButton.alpha = 0;
LK.gui.bottomLeft.addChild(rightButton);
// Movement button text labels
@@ -549,18 +549,18 @@
size: 120,
fill: 0xFFFFFF
});
upButtonText.anchor.set(0.5, 0.5);
-upButtonText.x = 200;
-upButtonText.y = -400;
+upButtonText.x = 300;
+upButtonText.y = -500;
upButtonText.alpha = 0;
LK.gui.bottomLeft.addChild(upButtonText);
var downButtonText = new Text2('↓', {
size: 120,
fill: 0xFFFFFF
});
downButtonText.anchor.set(0.5, 0.5);
-downButtonText.x = 200;
+downButtonText.x = 300;
downButtonText.y = -100;
downButtonText.alpha = 0;
LK.gui.bottomLeft.addChild(downButtonText);
var leftButtonText = new Text2('←', {
@@ -568,23 +568,29 @@
fill: 0xFFFFFF
});
leftButtonText.anchor.set(0.5, 0.5);
leftButtonText.x = 50;
-leftButtonText.y = -250;
+leftButtonText.y = -300;
leftButtonText.alpha = 0;
LK.gui.bottomLeft.addChild(leftButtonText);
var rightButtonText = new Text2('→', {
size: 120,
fill: 0xFFFFFF
});
rightButtonText.anchor.set(0.5, 0.5);
-rightButtonText.x = 350;
-rightButtonText.y = -250;
+rightButtonText.x = 550;
+rightButtonText.y = -300;
rightButtonText.alpha = 0;
LK.gui.bottomLeft.addChild(rightButtonText);
// Game mode state
var gameMode = 'build'; // 'build' or 'collect'
var disablePlacement = false; // Prevents placing objects while a button is pressed
+var buttonHeld = {
+ up: false,
+ down: false,
+ left: false,
+ right: false
+};
var placementCooldown = 0; // Frames left for placement cooldown (60 = 1s)
var placementCooldownText = new Text2('', {
size: 80,
fill: 0xFF0000
@@ -709,9 +715,9 @@
// Reset to default mode
gameMode = 'build';
selectedDefense = 'wall';
defenseText.setText('Defense: Wall (Cost: 10)');
- buttonIndicator.x = -150;
+ buttonIndicator.x = -350;
wallButtonText.tint = 0x00FF00;
trapButtonText.tint = 0xFFFFFF;
collectButtonText.tint = 0xFFFFFF;
// Spawn new resources
@@ -792,9 +798,9 @@
if (gameState === 'day') {
selectedDefense = 'wall';
gameMode = 'build';
defenseText.setText('Defense: Wall (Cost: 10)');
- buttonIndicator.x = -150;
+ buttonIndicator.x = -350;
wallButtonText.tint = 0x00FF00;
trapButtonText.tint = 0xFFFFFF;
collectButtonText.tint = 0xFFFFFF;
}
@@ -807,9 +813,9 @@
if (gameState === 'day') {
selectedDefense = 'trap';
gameMode = 'build';
defenseText.setText('Defense: Trap (Cost: 15)');
- buttonIndicator.x = -50;
+ buttonIndicator.x = 0;
wallButtonText.tint = 0xFFFFFF;
trapButtonText.tint = 0x00FF00;
collectButtonText.tint = 0xFFFFFF;
}
@@ -821,9 +827,9 @@
collectButton.down = function (x, y, obj) {
if (gameState === 'day') {
gameMode = 'collect';
defenseText.setText('Mode: Resource Collection');
- buttonIndicator.x = 50;
+ buttonIndicator.x = 350;
wallButtonText.tint = 0xFFFFFF;
trapButtonText.tint = 0xFFFFFF;
collectButtonText.tint = 0x00FF00;
}
@@ -834,42 +840,54 @@
};
// Movement button event handlers
upButton.down = function (x, y, obj) {
if (gameState !== 'platform_select') {
- player.y = Math.max(50, player.y - 30);
+ buttonHeld.up = true;
}
disablePlacement = true;
placementCooldown = 60;
placementCooldownText.alpha = 1;
placementCooldownText.setText('1');
};
+upButton.up = function (x, y, obj) {
+ buttonHeld.up = false;
+};
downButton.down = function (x, y, obj) {
if (gameState !== 'platform_select') {
- player.y = Math.min(2682, player.y + 30);
+ buttonHeld.down = true;
}
disablePlacement = true;
placementCooldown = 60;
placementCooldownText.alpha = 1;
placementCooldownText.setText('1');
};
+downButton.up = function (x, y, obj) {
+ buttonHeld.down = false;
+};
leftButton.down = function (x, y, obj) {
if (gameState !== 'platform_select') {
- player.x = Math.max(50, player.x - 30);
+ buttonHeld.left = true;
}
disablePlacement = true;
placementCooldown = 60;
placementCooldownText.alpha = 1;
placementCooldownText.setText('1');
};
+leftButton.up = function (x, y, obj) {
+ buttonHeld.left = false;
+};
rightButton.down = function (x, y, obj) {
if (gameState !== 'platform_select') {
- player.x = Math.min(1998, player.x + 30);
+ buttonHeld.right = true;
}
disablePlacement = true;
placementCooldown = 60;
placementCooldownText.alpha = 1;
placementCooldownText.setText('1');
};
+rightButton.up = function (x, y, obj) {
+ buttonHeld.right = false;
+};
game.down = function (x, y, obj) {
if (gameState === 'platform_select') {
return; // Don't allow interaction during platform selection
}
@@ -984,8 +1002,23 @@
game.update = function () {
if (gameState === 'platform_select') {
return; // Don't update game during platform selection
}
+ // Handle continuous movement when buttons are held
+ if (gameState !== 'platform_select' && platform === 'mobile') {
+ if (buttonHeld.up) {
+ player.y = Math.max(50, player.y - 5);
+ }
+ if (buttonHeld.down) {
+ player.y = Math.min(2682, player.y + 5);
+ }
+ if (buttonHeld.left) {
+ player.x = Math.max(50, player.x - 5);
+ }
+ if (buttonHeld.right) {
+ player.x = Math.min(1998, player.x + 5);
+ }
+ }
// Handle pistol reload timer
if (pistolReloading) {
pistolReloadTimer--;
pistolReloadText.alpha = 1;
Crea picos de madera, que todos estén unidos en una tablilla por abajo y que arriba estén los picos. In-Game asset. 2d. High contrast. No shadows
Crea un botón de color azul pixel. In-Game asset. 2d. High contrast. No shadows
Genera una imagen de lava pixel. In-Game asset. 2d. High contrast. No shadows
Genera una imagen de un guerrero pixel, sin armas, y que tenga la cabeza un poco más grande que el cuerpo tipo pixel. In-Game asset. 2d. High contrast. No shadows
Genera una imagen de un monstruo corrupto morado de piedra qué no sea tan terrorífico, y que sea pixel.Y qué tenga manos grandes, y torso y que la cabeza no sea tan terrorífico, y no le ponga ojos perturbadores, y que su cabeza sea de un tamaño moderado no muy grande, que algo que si sea grande sea sus brazos, y que tenga algas moradas y que tenga algunas piedras moradas y otras piedras que no sean moradas qué sean grises In-Game asset. 2d. High contrast. No shadows.
Genera una imagen verde solo verde oscuro. In-Game asset. 2d. High contrast. No shadows
Genera una imagen de una avispa no terroríficas, pixel y que sean moradas. Que sea corrupta In-Game asset. 2d. High contrast. No shadows
Genera una imagen de un corrupto pixel, y que no sea terrorífico y que sea morado. In-Game asset. 2d. High contrast. No shadows
Genera una imagen morado oscuro solo morado oscuro In-Game asset. 2d. High contrast. No shadows
Genera una imagen de una roca morada sonriente. In-Game asset. 2d. High contrast. No shadows
Genera una imagen de un círculo verde pixel. In-Game asset. 2d. High contrast. No shadows
Genera una imagen de un destello brillante morado pixel. In-Game asset. 2d. High contrast. No shadows
Genera una imagen de una pistola pixel. In-Game asset. 2d. High contrast. No shadows
Genera una imagen de una bala pixel. In-Game asset. 2d. High contrast. No shadows
Genera una imagen de un médico guerrero pixel, y que su cabeza sea un poco más grande que el cuerpo. Y que no tenga armas In-Game asset. 2d. High contrast. No shadows
Genera una imagen de un albañil guerrero pixel, que su cabeza sea un poco más grande que su cuerpo, y que no tenga armas. In-Game asset. 2d. High contrast. No shadows
Genera una imagen de un comerciante pixel y que su cabeza sea un poco más grande que su cuerpo. In-Game asset. 2d. High contrast. No shadows
Crea una imagen de un texto que diga "The corrupt survival" qué sea pixel y en la palabra "i" ponle una espada pixel. In-Game asset. 2d. High contrast. No shadows