User prompt
Make the background color dark red
User prompt
When it is Wave 20 add an enemy called “Sigma Blud” it has 10000 HP also add image asset for it
User prompt
When turrent is level 10, say it is Max Level
User prompt
When its wave 10 add Enemy named George Floyd, it has 5000 HP. And make an image asset for it
User prompt
Too slow
User prompt
Also make 6 7 kid hp 500
User prompt
Make the turrent shot speed slower
User prompt
Make an aimbot for turrents and make them shoot faster
User prompt
When waves get higher, the enemy number gets higher
User prompt
Add image asset for that
User prompt
When its wave 5 new enemy called “6 7 Kid” will be added to the game it has 300 HP
User prompt
Add turrents’s image asset
User prompt
when the turrent level is upgraded it deals more damage Lvl 1: 5 costs: 1 other one 3 Lvl2: 10 costs: 1 other one 4 Lvl3: 15 costs: 2 other one 5 Lvl4: 20 costs: 5 other one 10 Lvl5: 25 costs: 10 other one 20 Lvl6: 30 costs: 50 other one 50 Lvl7: 40 costs: 50 other one 60 Lvl8: 50 costs: 60 other one 70 Lvl9: 100 costs: 200 other one 250 Lvl10: 200 costs: 250 other one 300 dont make more turrents when its upgraded
User prompt
turrents shoots way faster and make their range bigger. also when I move my mouse the bullets move too ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
still not fixed
User prompt
fix the upgrade buttons, when I click them they are not activeting
User prompt
when player clicks the upgrade buttons, the turrent comes
User prompt
make the buttons bigger, and when the player buys the upgrades it oppens turrents that shoots enemies automatticly and every turrent's bullet deals 5 damage ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
add 2 upgrades button on player's left and right side. first upgrade costs 1 coin second one costs 3
User prompt
make the gun damage 5
User prompt
and make waves, every wave gets harder. and lower the enemy count
User prompt
when I hold my mouse it shoots
User prompt
make the game first person ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
make a movement joystick ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
make thhe enemies bigger and where are the movement button
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.damage = 2;
self.update = function () {
self.y -= self.speed;
};
return self;
});
var Mango = Container.expand(function () {
var self = Container.call(this);
var mangoGraphics = self.attachAsset('mango', {
anchorX: 0.5,
anchorY: 0.5
});
self.maxHealth = 100;
self.health = self.maxHealth;
self.speed = 2;
self.coinValue = 1;
self.lastHealth = self.health;
self.takeDamage = function (damage) {
self.health -= damage;
if (self.health < 0) self.health = 0;
};
self.update = function () {
self.y += self.speed;
// Flash red when taking damage
if (self.lastHealth > self.health) {
LK.effects.flashObject(self, 0xff0000, 300);
}
self.lastHealth = self.health;
};
return self;
});
var Mustard = Container.expand(function () {
var self = Container.call(this);
var mustardGraphics = self.attachAsset('mustard', {
anchorX: 0.5,
anchorY: 0.5
});
self.maxHealth = 200;
self.health = self.maxHealth;
self.speed = 1.5;
self.coinValue = 2;
self.lastHealth = self.health;
self.takeDamage = function (damage) {
self.health -= damage;
if (self.health < 0) self.health = 0;
};
self.update = function () {
self.y += self.speed;
// Flash red when taking damage
if (self.lastHealth > self.health) {
LK.effects.flashObject(self, 0xff0000, 300);
}
self.lastHealth = self.health;
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 100;
self.maxHealth = 100;
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2c3e50
});
/****
* Game Code
****/
// Game variables
var player;
var bullets = [];
var enemies = [];
var coins = 0;
var playerHealth = 100;
var gameStarted = false;
var enemySpawnTimer = 0;
var enemySpawnRate = 120; // frames between spawns
var difficultyTimer = 0;
var isMouseDown = false;
var mouseX = 0;
var mouseY = 0;
var shootCooldown = 0;
var shootRate = 10; // frames between shots when holding
// Create city background
var cityBuildings = [];
for (var i = 0; i < 12; i++) {
var buildingType = Math.floor(Math.random() * 3) + 1;
var building = LK.getAsset('cityBuilding' + buildingType, {
anchorX: 0.5,
anchorY: 1
});
building.x = i * 180 + 100;
building.y = 2732;
building.alpha = 0.3;
game.addChild(building);
cityBuildings.push(building);
}
// Create player
player = game.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 - 150;
// UI Elements
var coinText = new Text2('Coins: 0', {
size: 60,
fill: 0xFFFFFF
});
coinText.anchor.set(0, 0);
coinText.x = 150;
coinText.y = 50;
LK.gui.topLeft.addChild(coinText);
var healthText = new Text2('Health: 100', {
size: 60,
fill: 0xFF0000
});
healthText.anchor.set(1, 0);
LK.gui.topRight.addChild(healthText);
// Game functions
function spawnEnemy() {
var enemy;
var spawnX = Math.random() * (2048 - 100) + 50;
// 70% chance for Mango, 30% chance for Mustard
if (Math.random() < 0.7) {
enemy = new Mango();
} else {
enemy = new Mustard();
}
enemy.x = spawnX;
enemy.y = -50;
enemy.lastY = enemy.y;
enemies.push(enemy);
game.addChild(enemy);
}
function fireBullet(targetX, targetY) {
var bullet = new Bullet();
bullet.x = player.x;
bullet.y = player.y - 40;
bullet.lastY = bullet.y;
// Calculate angle to target
var deltaX = targetX - bullet.x;
var deltaY = targetY - bullet.y;
var angle = Math.atan2(deltaY, deltaX);
// Set bullet direction
bullet.velocityX = Math.cos(angle) * bullet.speed;
bullet.velocityY = Math.sin(angle) * bullet.speed;
// Override update to use calculated velocity
bullet.update = function () {
bullet.x += bullet.velocityX;
bullet.y += bullet.velocityY;
};
bullets.push(bullet);
game.addChild(bullet);
LK.getSound('shoot').play();
}
// Event handlers
game.down = function (x, y, obj) {
if (gameStarted) {
isMouseDown = true;
mouseX = x;
mouseY = y;
fireBullet(x, y);
} else {
gameStarted = true;
}
};
game.up = function (x, y, obj) {
isMouseDown = false;
};
game.move = function (x, y, obj) {
if (isMouseDown) {
mouseX = x;
mouseY = y;
}
};
// Main game loop
game.update = function () {
if (!gameStarted) {
return;
}
// Handle continuous shooting
if (isMouseDown) {
shootCooldown--;
if (shootCooldown <= 0) {
fireBullet(mouseX, mouseY);
shootCooldown = shootRate;
}
}
// Spawn enemies
enemySpawnTimer++;
if (enemySpawnTimer >= enemySpawnRate) {
spawnEnemy();
enemySpawnTimer = 0;
}
// Increase difficulty over time
difficultyTimer++;
if (difficultyTimer >= 1800) {
// Every 30 seconds
if (enemySpawnRate > 30) {
enemySpawnRate -= 5;
}
difficultyTimer = 0;
}
// Update bullets
for (var i = bullets.length - 1; i >= 0; i--) {
var bullet = bullets[i];
// Remove bullets that go off screen
if (bullet.lastY <= 2732 && (bullet.y > 2732 || bullet.y < -50 || bullet.x < -50 || bullet.x > 2098)) {
bullet.destroy();
bullets.splice(i, 1);
continue;
}
bullet.lastY = bullet.y;
}
// Update enemies and check collisions
for (var j = enemies.length - 1; j >= 0; j--) {
var enemy = enemies[j];
// Remove enemies that reach bottom (player takes damage)
if (enemy.lastY < 2732 && enemy.y >= 2732) {
playerHealth -= 20;
healthText.setText('Health: ' + playerHealth);
LK.effects.flashScreen(0xff0000, 500);
if (playerHealth <= 0) {
LK.setScore(coins);
LK.showGameOver();
return;
}
enemy.destroy();
enemies.splice(j, 1);
continue;
}
// Check bullet collisions
for (var k = bullets.length - 1; k >= 0; k--) {
var bullet = bullets[k];
if (bullet.intersects(enemy)) {
enemy.takeDamage(bullet.damage);
LK.getSound('enemyHit').play();
// Remove bullet
bullet.destroy();
bullets.splice(k, 1);
// Check if enemy is dead
if (enemy.health <= 0) {
coins += enemy.coinValue;
coinText.setText('Coins: ' + coins);
LK.getSound('enemyDeath').play();
enemy.destroy();
enemies.splice(j, 1);
}
break;
}
}
enemy.lastY = enemy.y;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -34,21 +34,9 @@
self.health -= damage;
if (self.health < 0) self.health = 0;
};
self.update = function () {
- // Move towards camera position (bottom center) for first-person perspective
- var cameraX = 2048 / 2;
- var cameraY = 2732 - 50;
- var deltaX = cameraX - self.x;
- var deltaY = cameraY - self.y;
- var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
- if (distance > 10) {
- // Normalize direction and apply speed
- var dirX = deltaX / distance * self.speed;
- var dirY = deltaY / distance * self.speed;
- self.x += dirX;
- self.y += dirY;
- }
+ self.y += self.speed;
// Flash red when taking damage
if (self.lastHealth > self.health) {
LK.effects.flashObject(self, 0xff0000, 300);
}
@@ -71,21 +59,9 @@
self.health -= damage;
if (self.health < 0) self.health = 0;
};
self.update = function () {
- // Move towards camera position (bottom center) for first-person perspective
- var cameraX = 2048 / 2;
- var cameraY = 2732 - 50;
- var deltaX = cameraX - self.x;
- var deltaY = cameraY - self.y;
- var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
- if (distance > 10) {
- // Normalize direction and apply speed
- var dirX = deltaX / distance * self.speed;
- var dirY = deltaY / distance * self.speed;
- self.x += dirX;
- self.y += dirY;
- }
+ self.y += self.speed;
// Flash red when taking damage
if (self.lastHealth > self.health) {
LK.effects.flashObject(self, 0xff0000, 300);
}
@@ -96,64 +72,12 @@
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
- anchorY: 0.5,
- alpha: 0 // Make player invisible for first-person view
+ anchorY: 0.5
});
self.health = 100;
self.maxHealth = 100;
- self.moveTo = function (targetX, targetY) {
- // Stop any existing movement tween
- tween.stop(self, {
- x: true,
- y: true
- });
- // Calculate distance for duration scaling
- var deltaX = targetX - self.x;
- var deltaY = targetY - self.y;
- var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
- // Only move if distance is significant
- if (distance > 5) {
- // Much faster movement with shorter duration
- var duration = Math.min(distance * 0.8, 300);
- // Smooth tween movement with more responsive easing
- tween(self, {
- x: targetX,
- y: targetY
- }, {
- duration: duration,
- easing: tween.easeInOut,
- onFinish: function onFinish() {
- // Add slight bounce effect when reaching destination
- tween(self, {
- scaleX: 1.1,
- scaleY: 1.1
- }, {
- duration: 100,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- tween(self, {
- scaleX: 1,
- scaleY: 1
- }, {
- duration: 100,
- easing: tween.easeIn
- });
- }
- });
- }
- });
- }
- };
- self.update = function () {
- // Keep camera position within screen bounds for first-person view
- if (self.x < 40) self.x = 40;
- if (self.x > 2048 - 40) self.x = 2048 - 40;
- // Keep camera near bottom for first-person perspective
- if (self.y < 2732 - 200) self.y = 2732 - 200;
- if (self.y > 2732 - 30) self.y = 2732 - 30;
- };
return self;
});
/****
@@ -175,19 +99,13 @@
var gameStarted = false;
var enemySpawnTimer = 0;
var enemySpawnRate = 120; // frames between spawns
var difficultyTimer = 0;
-// Movement variables
-var isDragging = false;
-var playerSpeed = 8;
-var targetX = 0;
-var targetY = 0;
-// Shooting variables
-var isShooting = false;
-var shootTimer = null;
-var shootInterval = 8; // frames between shots when holding
-var lastShootX = 0;
-var lastShootY = 0;
+var isMouseDown = false;
+var mouseX = 0;
+var mouseY = 0;
+var shootCooldown = 0;
+var shootRate = 10; // frames between shots when holding
// Create city background
var cityBuildings = [];
for (var i = 0; i < 12; i++) {
var buildingType = Math.floor(Math.random() * 3) + 1;
@@ -200,12 +118,12 @@
building.alpha = 0.3;
game.addChild(building);
cityBuildings.push(building);
}
-// Create player (invisible for first-person view)
+// Create player
player = game.addChild(new Player());
player.x = 2048 / 2;
-player.y = 2732 - 50; // Position at very bottom for first-person perspective
+player.y = 2732 - 150;
// UI Elements
var coinText = new Text2('Coins: 0', {
size: 60,
fill: 0xFFFFFF
@@ -219,84 +137,8 @@
fill: 0xFF0000
});
healthText.anchor.set(1, 0);
LK.gui.topRight.addChild(healthText);
-// Joystick System
-var joystickBase = LK.getAsset('joystickBase', {
- anchorX: 0.5,
- anchorY: 0.5,
- alpha: 0.6
-});
-var joystickKnob = LK.getAsset('joystickKnob', {
- anchorX: 0.5,
- anchorY: 0.5,
- alpha: 0.8
-});
-joystickBase.x = 150;
-joystickBase.y = -150;
-joystickKnob.x = 150;
-joystickKnob.y = -150;
-var joystickActive = false;
-var joystickCenter = {
- x: 150,
- y: -150
-};
-var joystickMaxRadius = 50;
-LK.gui.bottomLeft.addChild(joystickBase);
-LK.gui.bottomLeft.addChild(joystickKnob);
-// Joystick functions
-function activateJoystick(x, y) {
- joystickActive = true;
- var localPos = LK.gui.bottomLeft.toLocal({
- x: x,
- y: y
- });
- var deltaX = localPos.x - joystickCenter.x;
- var deltaY = localPos.y - joystickCenter.y;
- var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
- // Limit knob movement within joystick radius
- if (distance > joystickMaxRadius) {
- deltaX = deltaX / distance * joystickMaxRadius;
- deltaY = deltaY / distance * joystickMaxRadius;
- distance = joystickMaxRadius;
- }
- // Update knob position with smooth tween
- tween.stop(joystickKnob, {
- x: true,
- y: true
- });
- tween(joystickKnob, {
- x: joystickCenter.x + deltaX,
- y: joystickCenter.y + deltaY
- }, {
- duration: 50,
- easing: tween.easeOut
- });
- // Calculate movement strength (0 to 1)
- var moveStrength = distance / joystickMaxRadius;
- if (moveStrength > 0.1) {
- // Dead zone
- // Calculate continuous movement
- var moveSpeed = 6;
- var playerTargetX = player.x + deltaX * moveSpeed * moveStrength * 0.5;
- var playerTargetY = player.y + deltaY * moveSpeed * moveStrength * 0.5;
- // Keep within bounds
- playerTargetX = Math.max(40, Math.min(2048 - 40, playerTargetX));
- playerTargetY = Math.max(200, Math.min(2732 - 100, playerTargetY));
- player.moveTo(playerTargetX, playerTargetY);
- }
-}
-function deactivateJoystick() {
- joystickActive = false;
- // Return knob to center with smooth tween
- tween(joystickKnob, {
- x: joystickCenter.x,
- y: joystickCenter.y
- }, {
- duration: 300,
- easing: tween.easeOut
- });
-}
// Game functions
function spawnEnemy() {
var enemy;
var spawnX = Math.random() * (2048 - 100) + 50;
@@ -313,11 +155,10 @@
game.addChild(enemy);
}
function fireBullet(targetX, targetY) {
var bullet = new Bullet();
- // Shoot from bottom center of screen for first-person perspective
- bullet.x = 2048 / 2;
- bullet.y = 2732 - 100;
+ bullet.x = player.x;
+ bullet.y = player.y - 40;
bullet.lastY = bullet.y;
// Calculate angle to target
var deltaX = targetX - bullet.x;
var deltaY = targetY - bullet.y;
@@ -336,113 +177,38 @@
}
// Event handlers
game.down = function (x, y, obj) {
if (gameStarted) {
- // Convert coordinates to check if touching joystick
- var guiPos = LK.gui.bottomLeft.toLocal({
- x: x,
- y: y
- });
- var joystickDistance = Math.sqrt((guiPos.x - joystickCenter.x) * (guiPos.x - joystickCenter.x) + (guiPos.y - joystickCenter.y) * (guiPos.y - joystickCenter.y));
- if (joystickDistance < 80) {
- // Touching joystick area
- activateJoystick(x, y);
- } else if (y < 2732 / 2) {
- // Top half - start continuous shooting
- isShooting = true;
- lastShootX = x;
- lastShootY = y;
- // Fire first bullet immediately
- fireBullet(x, y);
- } else {
- // Bottom half - fallback movement (keep existing behavior)
- isDragging = true;
- targetX = x;
- targetY = y;
- // Add immediate visual feedback on touch
- tween(player, {
- scaleX: 0.9,
- scaleY: 0.9
- }, {
- duration: 100,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- tween(player, {
- scaleX: 1,
- scaleY: 1
- }, {
- duration: 100
- });
- }
- });
- player.moveTo(x, y);
- }
+ isMouseDown = true;
+ mouseX = x;
+ mouseY = y;
+ fireBullet(x, y);
} else {
gameStarted = true;
}
};
+game.up = function (x, y, obj) {
+ isMouseDown = false;
+};
game.move = function (x, y, obj) {
- if (gameStarted) {
- if (joystickActive) {
- // Update joystick position and player movement
- activateJoystick(x, y);
- } else if (isShooting && y < 2732 / 2) {
- // Update shooting target position
- lastShootX = x;
- lastShootY = y;
- } else if (isDragging && y >= 2732 / 2) {
- // More responsive movement with lower threshold
- var deltaX = x - targetX;
- var deltaY = y - targetY;
- var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
- if (distance > 15) {
- // More responsive movement threshold
- targetX = x;
- targetY = y;
- player.moveTo(x, y);
- // Add visual feedback for movement
- tween(player, {
- tint: 0xffffff
- }, {
- duration: 50,
- onFinish: function onFinish() {
- tween(player, {
- tint: 0x4a90e2
- }, {
- duration: 100
- });
- }
- });
- }
- }
+ if (isMouseDown) {
+ mouseX = x;
+ mouseY = y;
}
};
-game.up = function (x, y, obj) {
- if (joystickActive) {
- deactivateJoystick();
- }
- isDragging = false;
- isShooting = false;
-};
// Main game loop
game.update = function () {
if (!gameStarted) {
return;
}
// Handle continuous shooting
- if (isShooting) {
- if (shootTimer === null) {
- shootTimer = 0;
+ if (isMouseDown) {
+ shootCooldown--;
+ if (shootCooldown <= 0) {
+ fireBullet(mouseX, mouseY);
+ shootCooldown = shootRate;
}
- shootTimer++;
- if (shootTimer >= shootInterval) {
- fireBullet(lastShootX, lastShootY);
- shootTimer = 0;
- }
- } else {
- shootTimer = null;
}
- // Player movement is now handled by tween system
// Spawn enemies
enemySpawnTimer++;
if (enemySpawnTimer >= enemySpawnRate) {
spawnEnemy();
@@ -470,10 +236,10 @@
}
// Update enemies and check collisions
for (var j = enemies.length - 1; j >= 0; j--) {
var enemy = enemies[j];
- // Check if enemy collides with player
- if (enemy.intersects(player)) {
+ // Remove enemies that reach bottom (player takes damage)
+ if (enemy.lastY < 2732 && enemy.y >= 2732) {
playerHealth -= 20;
healthText.setText('Health: ' + playerHealth);
LK.effects.flashScreen(0xff0000, 500);
if (playerHealth <= 0) {
@@ -484,14 +250,8 @@
enemy.destroy();
enemies.splice(j, 1);
continue;
}
- // Remove enemies that go too far off screen
- if (enemy.y > 2732 + 100 || enemy.x < -100 || enemy.x > 2148) {
- enemy.destroy();
- enemies.splice(j, 1);
- continue;
- }
// Check bullet collisions
for (var k = bullets.length - 1; k >= 0; k--) {
var bullet = bullets[k];
if (bullet.intersects(enemy)) {