User prompt
use Hpot sset for potion
User prompt
make health Artfact a different class named potion
User prompt
mke weapon buffs staced at weapons tab
User prompt
show artifacts duration in artifacts tab
User prompt
make all the buffs stackable
User prompt
give artifacts duration, they will last for 15 seconds
User prompt
use weapon asset for weapons
User prompt
make an artifact tab at top-right corner, under the health tab
User prompt
replace artifact tab under health bar
User prompt
make two different tabs for artifacts and wepons
User prompt
make buffs gainet from chest permanent and name them 'weapons'
User prompt
create a tab for active buffs
User prompt
use the chest asset for chest in game
User prompt
Please fix the bug: 'Uncaught TypeError: setTimeout is not a function' in or related to this line: 'setTimeout(function () {' Line Number: 638
User prompt
add chests after each wave that gives a permanent buff we chose out of three, those buffs will be health increase, damage increase and shooting speed ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
change green artifact colour to red ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
change red artifact colour to purple ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
make Artifact double the size and glow ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
make the projectile asset turn as shooting direction
User prompt
use the bakground image form Assets as background and change background colour to brown
User prompt
add 3 Artifect: projectile speed boost, shooting speed boost and damage increasft boost
User prompt
double the enemy Health
User prompt
increas enemy speed by double
User prompt
make shooting speed 1/2
User prompt
make projectile speed 1/3
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Artifact = Container.expand(function (artifactType) { var self = Container.call(this); self.artifactType = artifactType || 'health'; var artifactGraphics = self.attachAsset('artifact', { anchorX: 0.5, anchorY: 0.5 }); // Set color based on artifact type if (self.artifactType === 'projectileSpeed') { artifactGraphics.tint = 0x00ffff; // Cyan for projectile speed } else if (self.artifactType === 'shootingSpeed') { artifactGraphics.tint = 0xffff00; // Yellow for shooting speed } else if (self.artifactType === 'damage') { artifactGraphics.tint = 0xff0000; // Red for damage } else { artifactGraphics.tint = 0x00ff00; // Green for health } self.collected = false; self.lifeTime = 0; self.collect = function () { if (!self.collected) { self.collected = true; LK.getSound('powerUp').play(); LK.setScore(LK.getScore() + 100); // Apply different effects based on artifact type if (self.artifactType === 'health') { // Heal hero hero.health = Math.min(hero.maxHealth, hero.health + 20); } else if (self.artifactType === 'projectileSpeed') { // Increase projectile speed for 10 seconds hero.projectileSpeedBoost = 600; // 10 seconds at 60fps hero.projectileSpeedMultiplier = 2; } else if (self.artifactType === 'shootingSpeed') { // Increase shooting speed for 10 seconds hero.shootingSpeedBoost = 600; // 10 seconds at 60fps hero.shootingSpeedMultiplier = 2; } else if (self.artifactType === 'damage') { // Increase damage for 15 seconds hero.damageBoost = 900; // 15 seconds at 60fps hero.damageMultiplier = 3; } // Remove from artifacts array for (var i = artifacts.length - 1; i >= 0; i--) { if (artifacts[i] === self) { artifacts.splice(i, 1); break; } } tween(self, { scaleX: 0, scaleY: 0 }, { duration: 200, onFinish: function onFinish() { self.destroy(); } }); } }; self.update = function () { self.lifeTime++; self.rotation += 0.1; // Pulse effect var pulse = Math.sin(self.lifeTime * 0.2) * 0.2 + 1; self.scaleX = pulse; self.scaleY = pulse; // Despawn after 10 seconds if (self.lifeTime > 600) { for (var i = artifacts.length - 1; i >= 0; i--) { if (artifacts[i] === self) { artifacts.splice(i, 1); break; } } self.destroy(); } }; return self; }); var Enemy = Container.expand(function (enemyType) { var self = Container.call(this); self.enemyType = enemyType || 'minotaur'; self.health = 2; self.damage = 10; self.speed = 2; self.points = 10; var enemyGraphics; if (self.enemyType === 'minotaur') { enemyGraphics = self.attachAsset('minotaur', { anchorX: 0.5, anchorY: 0.5 }); self.health = 4; self.speed = 3; self.points = 15; } else if (self.enemyType === 'harpy') { enemyGraphics = self.attachAsset('harpy', { anchorX: 0.5, anchorY: 0.5 }); self.health = 2; self.speed = 6; self.points = 20; } else if (self.enemyType === 'cyclops') { enemyGraphics = self.attachAsset('cyclops', { anchorX: 0.5, anchorY: 0.5 }); self.health = 8; self.speed = 2; self.damage = 20; self.points = 50; } self.takeDamage = function (damage) { self.health -= damage; LK.effects.flashObject(self, 0xFFFFFF, 200); if (self.health <= 0) { self.die(); } }; self.die = function () { LK.getSound('enemyHit').play(); LK.setScore(LK.getScore() + self.points); // Chance to drop artifact if (Math.random() < 0.15) { var artifactTypes = ['health', 'projectileSpeed', 'shootingSpeed', 'damage']; var randomType = artifactTypes[Math.floor(Math.random() * artifactTypes.length)]; var artifact = new Artifact(randomType); artifact.x = self.x; artifact.y = self.y; artifacts.push(artifact); game.addChild(artifact); } // Remove from enemies array for (var i = enemies.length - 1; i >= 0; i--) { if (enemies[i] === self) { enemies.splice(i, 1); break; } } self.destroy(); }; self.update = function () { // Move towards hero var dx = hero.x - self.x; var dy = hero.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } }; return self; }); var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.attachAsset('hero', { anchorX: 0.5, anchorY: 0.5 }); self.health = 100; self.maxHealth = 100; self.shootCooldown = 0; self.speed = 8; // Boost properties self.projectileSpeedBoost = 0; self.projectileSpeedMultiplier = 1; self.shootingSpeedBoost = 0; self.shootingSpeedMultiplier = 1; self.damageBoost = 0; self.damageMultiplier = 1; self.takeDamage = function (damage) { self.health -= damage; LK.effects.flashObject(self, 0xFF0000, 300); if (self.health <= 0) { gameOver = true; } }; self.shoot = function () { if (self.shootCooldown <= 0) { var bullet = new HeroBullet(); bullet.x = self.x; bullet.y = self.y - 40; // Apply projectile speed boost if (self.projectileSpeedBoost > 0) { bullet.speed = 4 * self.projectileSpeedMultiplier; } // Apply damage boost if (self.damageBoost > 0) { bullet.damage = 1 * self.damageMultiplier; } // Find nearest enemy for auto-aim var nearestEnemy = null; var nearestDistance = Infinity; for (var i = 0; i < enemies.length; i++) { var enemy = enemies[i]; var dx = enemy.x - self.x; var dy = enemy.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < nearestDistance) { nearestDistance = distance; nearestEnemy = enemy; } } // Set bullet direction towards nearest enemy if (nearestEnemy) { var dx = nearestEnemy.x - self.x; var dy = nearestEnemy.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { bullet.directionX = dx / distance; bullet.directionY = dy / distance; } } else { // Default upward direction if no enemies bullet.directionX = 0; bullet.directionY = -1; } heroBullets.push(bullet); game.addChild(bullet); LK.getSound('shoot').play(); // Apply shooting speed boost var cooldownTime = 10; if (self.shootingSpeedBoost > 0) { cooldownTime = Math.floor(cooldownTime / self.shootingSpeedMultiplier); } self.shootCooldown = cooldownTime; } }; self.update = function () { if (self.shootCooldown > 0) { self.shootCooldown--; } // Update boost timers if (self.projectileSpeedBoost > 0) { self.projectileSpeedBoost--; if (self.projectileSpeedBoost <= 0) { self.projectileSpeedMultiplier = 1; } } if (self.shootingSpeedBoost > 0) { self.shootingSpeedBoost--; if (self.shootingSpeedBoost <= 0) { self.shootingSpeedMultiplier = 1; } } if (self.damageBoost > 0) { self.damageBoost--; if (self.damageBoost <= 0) { self.damageMultiplier = 1; } } }; return self; }); var HeroBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('heroBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 4; self.damage = 1; self.directionX = 0; self.directionY = -1; self.update = function () { self.x += self.directionX * self.speed; self.y += self.directionY * self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a2e }); /**** * Game Code ****/ // Game variables var hero; var heroBullets = []; var enemies = []; var artifacts = []; var enemySpawnTimer = 0; var gameOver = false; var dragActive = false; var waveLevel = 1; // UI var scoreTxt = new Text2('Score: 0', { size: 60, fill: 0xFFFFFF }); scoreTxt.anchor.set(0, 0); scoreTxt.x = 120; scoreTxt.y = 50; LK.gui.topLeft.addChild(scoreTxt); var healthTxt = new Text2('Health: 100', { size: 60, fill: 0xFF4444 }); healthTxt.anchor.set(1, 0); LK.gui.topRight.addChild(healthTxt); var waveTxt = new Text2('Wave: 1', { size: 50, fill: 0x44FF44 }); waveTxt.anchor.set(0.5, 0); LK.gui.top.addChild(waveTxt); // Initialize hero hero = new Hero(); hero.x = 1024; hero.y = 2000; game.addChild(hero); // Spawn enemy function function spawnEnemy() { var enemyTypes = ['minotaur', 'harpy', 'cyclops']; var type = enemyTypes[Math.floor(Math.random() * enemyTypes.length)]; // Cyclops only spawn in later waves if (type === 'cyclops' && waveLevel < 3) { type = 'minotaur'; } var enemy = new Enemy(type); // Spawn from random edge var side = Math.floor(Math.random() * 4); if (side === 0) { // Top enemy.x = Math.random() * 2048; enemy.y = -100; } else if (side === 1) { // Right enemy.x = 2148; enemy.y = Math.random() * 2732; } else if (side === 2) { // Bottom enemy.x = Math.random() * 2048; enemy.y = 2832; } else { // Left enemy.x = -100; enemy.y = Math.random() * 2732; } enemies.push(enemy); game.addChild(enemy); } // Touch controls game.down = function (x, y, obj) { dragActive = true; hero.x = x; hero.y = y; hero.shoot(); }; game.move = function (x, y, obj) { if (dragActive) { hero.x = x; hero.y = y; } }; game.up = function (x, y, obj) { dragActive = false; }; // Main game loop game.update = function () { if (gameOver) { LK.showGameOver(); return; } // Update hero hero.update(); // Keep hero in bounds hero.x = Math.max(40, Math.min(2008, hero.x)); hero.y = Math.max(40, Math.min(2692, hero.y)); // Auto-shoot var autoShootRate = 30; if (hero.shootingSpeedBoost > 0) { autoShootRate = Math.floor(autoShootRate / hero.shootingSpeedMultiplier); } if (LK.ticks % autoShootRate === 0) { hero.shoot(); } // Spawn enemies enemySpawnTimer++; var spawnRate = Math.max(30, 120 - waveLevel * 10); if (enemySpawnTimer >= spawnRate) { spawnEnemy(); enemySpawnTimer = 0; } // Update bullets for (var i = heroBullets.length - 1; i >= 0; i--) { var bullet = heroBullets[i]; bullet.update(); // Remove bullets that are off-screen if (bullet.y < -50) { bullet.destroy(); heroBullets.splice(i, 1); continue; } // Check bullet vs enemy collisions for (var j = enemies.length - 1; j >= 0; j--) { var enemy = enemies[j]; if (bullet.intersects(enemy)) { enemy.takeDamage(bullet.damage); bullet.destroy(); heroBullets.splice(i, 1); break; } } } // Update enemies for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; enemy.update(); // Check hero vs enemy collision if (enemy.intersects(hero)) { hero.takeDamage(enemy.damage); enemy.die(); } // Remove enemies that are too far off-screen if (enemy.x < -200 || enemy.x > 2248 || enemy.y < -200 || enemy.y > 2932) { enemies.splice(i, 1); enemy.destroy(); } } // Update artifacts for (var i = artifacts.length - 1; i >= 0; i--) { var artifact = artifacts[i]; artifact.update(); // Check hero vs artifact collision if (artifact.intersects(hero)) { artifact.collect(); } } // Update wave level based on score var newWaveLevel = Math.floor(LK.getScore() / 500) + 1; if (newWaveLevel > waveLevel) { waveLevel = newWaveLevel; LK.effects.flashScreen(0x00FF00, 500); } // Update UI scoreTxt.setText('Score: ' + LK.getScore()); healthTxt.setText('Health: ' + hero.health); waveTxt.setText('Wave: ' + waveLevel); }; // Start background music LK.playMusic('dungeonMusic');
===================================================================
--- original.js
+++ change.js
@@ -5,23 +5,49 @@
/****
* Classes
****/
-var Artifact = Container.expand(function () {
+var Artifact = Container.expand(function (artifactType) {
var self = Container.call(this);
+ self.artifactType = artifactType || 'health';
var artifactGraphics = self.attachAsset('artifact', {
anchorX: 0.5,
anchorY: 0.5
});
+ // Set color based on artifact type
+ if (self.artifactType === 'projectileSpeed') {
+ artifactGraphics.tint = 0x00ffff; // Cyan for projectile speed
+ } else if (self.artifactType === 'shootingSpeed') {
+ artifactGraphics.tint = 0xffff00; // Yellow for shooting speed
+ } else if (self.artifactType === 'damage') {
+ artifactGraphics.tint = 0xff0000; // Red for damage
+ } else {
+ artifactGraphics.tint = 0x00ff00; // Green for health
+ }
self.collected = false;
self.lifeTime = 0;
self.collect = function () {
if (!self.collected) {
self.collected = true;
LK.getSound('powerUp').play();
LK.setScore(LK.getScore() + 100);
- // Heal hero
- hero.health = Math.min(hero.maxHealth, hero.health + 20);
+ // Apply different effects based on artifact type
+ if (self.artifactType === 'health') {
+ // Heal hero
+ hero.health = Math.min(hero.maxHealth, hero.health + 20);
+ } else if (self.artifactType === 'projectileSpeed') {
+ // Increase projectile speed for 10 seconds
+ hero.projectileSpeedBoost = 600; // 10 seconds at 60fps
+ hero.projectileSpeedMultiplier = 2;
+ } else if (self.artifactType === 'shootingSpeed') {
+ // Increase shooting speed for 10 seconds
+ hero.shootingSpeedBoost = 600; // 10 seconds at 60fps
+ hero.shootingSpeedMultiplier = 2;
+ } else if (self.artifactType === 'damage') {
+ // Increase damage for 15 seconds
+ hero.damageBoost = 900; // 15 seconds at 60fps
+ hero.damageMultiplier = 3;
+ }
// Remove from artifacts array
for (var i = artifacts.length - 1; i >= 0; i--) {
if (artifacts[i] === self) {
artifacts.splice(i, 1);
@@ -104,9 +130,11 @@
LK.getSound('enemyHit').play();
LK.setScore(LK.getScore() + self.points);
// Chance to drop artifact
if (Math.random() < 0.15) {
- var artifact = new Artifact();
+ var artifactTypes = ['health', 'projectileSpeed', 'shootingSpeed', 'damage'];
+ var randomType = artifactTypes[Math.floor(Math.random() * artifactTypes.length)];
+ var artifact = new Artifact(randomType);
artifact.x = self.x;
artifact.y = self.y;
artifacts.push(artifact);
game.addChild(artifact);
@@ -141,8 +169,15 @@
self.health = 100;
self.maxHealth = 100;
self.shootCooldown = 0;
self.speed = 8;
+ // Boost properties
+ self.projectileSpeedBoost = 0;
+ self.projectileSpeedMultiplier = 1;
+ self.shootingSpeedBoost = 0;
+ self.shootingSpeedMultiplier = 1;
+ self.damageBoost = 0;
+ self.damageMultiplier = 1;
self.takeDamage = function (damage) {
self.health -= damage;
LK.effects.flashObject(self, 0xFF0000, 300);
if (self.health <= 0) {
@@ -153,8 +188,16 @@
if (self.shootCooldown <= 0) {
var bullet = new HeroBullet();
bullet.x = self.x;
bullet.y = self.y - 40;
+ // Apply projectile speed boost
+ if (self.projectileSpeedBoost > 0) {
+ bullet.speed = 4 * self.projectileSpeedMultiplier;
+ }
+ // Apply damage boost
+ if (self.damageBoost > 0) {
+ bullet.damage = 1 * self.damageMultiplier;
+ }
// Find nearest enemy for auto-aim
var nearestEnemy = null;
var nearestDistance = Infinity;
for (var i = 0; i < enemies.length; i++) {
@@ -183,15 +226,39 @@
}
heroBullets.push(bullet);
game.addChild(bullet);
LK.getSound('shoot').play();
- self.shootCooldown = 10;
+ // Apply shooting speed boost
+ var cooldownTime = 10;
+ if (self.shootingSpeedBoost > 0) {
+ cooldownTime = Math.floor(cooldownTime / self.shootingSpeedMultiplier);
+ }
+ self.shootCooldown = cooldownTime;
}
};
self.update = function () {
if (self.shootCooldown > 0) {
self.shootCooldown--;
}
+ // Update boost timers
+ if (self.projectileSpeedBoost > 0) {
+ self.projectileSpeedBoost--;
+ if (self.projectileSpeedBoost <= 0) {
+ self.projectileSpeedMultiplier = 1;
+ }
+ }
+ if (self.shootingSpeedBoost > 0) {
+ self.shootingSpeedBoost--;
+ if (self.shootingSpeedBoost <= 0) {
+ self.shootingSpeedMultiplier = 1;
+ }
+ }
+ if (self.damageBoost > 0) {
+ self.damageBoost--;
+ if (self.damageBoost <= 0) {
+ self.damageMultiplier = 1;
+ }
+ }
};
return self;
});
var HeroBullet = Container.expand(function () {
@@ -314,9 +381,13 @@
// Keep hero in bounds
hero.x = Math.max(40, Math.min(2008, hero.x));
hero.y = Math.max(40, Math.min(2692, hero.y));
// Auto-shoot
- if (LK.ticks % 30 === 0) {
+ var autoShootRate = 30;
+ if (hero.shootingSpeedBoost > 0) {
+ autoShootRate = Math.floor(autoShootRate / hero.shootingSpeedMultiplier);
+ }
+ if (LK.ticks % autoShootRate === 0) {
hero.shoot();
}
// Spawn enemies
enemySpawnTimer++;
a realistic cyclops face. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
a woman who has wings instead of arms and talons instead of legs. realistic
a realistic angry bull head. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
a realistic gold chalice. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
a realistic face of a spartan warrior. In-Game asset. 2d. High contrast. No shadows
make this photo up to down
a darker green
a medieval chest. In-Game asset. 2d. High contrast. No shadows
a mediaval sword. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
a classic health potion, a bottle of translucent red liquid. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat