User prompt
que el personage aguante 3 golpes
User prompt
que el juego sea infinito
User prompt
un menu
User prompt
que el menu prinsipal tenga las obciones de obciones jugar y creditos
User prompt
que haya un menu prinsipal
User prompt
que el personage aguanta 3 ataques
User prompt
que el juego sea infinito
User prompt
que los ataques sean un fuego teledirigido y un orbe explosivo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
crea 2 ataques nuevos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que hayan 4 enemigos mas
User prompt
que tenga un sistema de ordas que aumentan la dificultad
User prompt
que haya un refugio que luego de 10000 puntos el personage entre y le de un multiplicador de daño mas un escudo al salir por 6 seg ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
añade una vase que luego de tener sierto puntage el personage entre a resguardarse
User prompt
que el ataque de orbe no se pueda tirar mas de 7 veses por orda
User prompt
que el ataque de orbe tenga un tiempo de 7 seg de recarga
User prompt
que el ataque de orbe tenga una recarga de 7
User prompt
que los enemigos tengan una barra de vida
User prompt
ahora que el proyectil ligrto se active con un boton
User prompt
que cada enemigo tenga distinta cantidad de vida
User prompt
ahora que el ataque de luz tenga solo 12 seg de recarga
User prompt
ahora que el ataque de luz tenga una recarga de 3 segundos y que elimine a todos los enemigos en pantalla ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que el ataque de fuego valla directamente al enemigo
User prompt
que los ataques del personage se activen con un boton en pantalla
User prompt
que haya una gran bariedad de monstruos
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var BomberShadow = Container.expand(function () { var self = Container.call(this); var shadowGraphics = self.attachAsset('bomberShadow', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2 + Math.random() * 1; self.health = 2; self.monsterType = 'bomber'; self.exploding = false; self.explosionTimer = 30; self.update = function () { var angle = Math.atan2(hero.y - self.y, hero.x - self.x); var distanceToHero = Math.sqrt(Math.pow(hero.x - self.x, 2) + Math.pow(hero.y - self.y, 2)); if (distanceToHero < 100 && !self.exploding) { self.exploding = true; shadowGraphics.tint = 0xff4444; } if (self.exploding) { self.explosionTimer--; var flash = Math.sin(self.explosionTimer * 0.5) > 0 ? 0xff0000 : 0xffff00; shadowGraphics.tint = flash; if (self.explosionTimer <= 0) { // Create explosion effect for (var i = 0; i < 6; i++) { var explosionAngle = i / 6 * Math.PI * 2; var fragment = new Shadow(); fragment.x = self.x + Math.cos(explosionAngle) * 20; fragment.y = self.y + Math.sin(explosionAngle) * 20; fragment.speed = 2; shadows.push(fragment); game.addChild(fragment); } } } else { self.x += Math.cos(angle) * self.speed; self.y += Math.sin(angle) * self.speed; } }; return self; }); var FastShadow = Container.expand(function () { var self = Container.call(this); var shadowGraphics = self.attachAsset('fastShadow', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 3 + Math.random() * 2; self.health = 1; self.monsterType = 'fast'; self.update = function () { var angle = Math.atan2(hero.y - self.y, hero.x - self.x); self.x += Math.cos(angle) * self.speed; self.y += Math.sin(angle) * self.speed; // Add erratic movement self.x += Math.sin(LK.ticks * 0.2) * 2; self.y += Math.cos(LK.ticks * 0.15) * 2; }; return self; }); var FireSpell = Container.expand(function () { var self = Container.call(this); var spellGraphics = self.attachAsset('fireSpell', { anchorX: 0.5, anchorY: 0.5 }); self.lifetime = 30; // Half second self.radius = 80; self.update = function () { self.lifetime--; // Grow the spell var scale = 1 + (30 - self.lifetime) / 30; spellGraphics.scaleX = scale; spellGraphics.scaleY = scale; spellGraphics.alpha = self.lifetime / 30; }; return self; }); var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.attachAsset('hero', { anchorX: 0.5, anchorY: 0.5 }); self.lightPower = 1; self.fireRate = 60; // Fire every 60 ticks initially self.lastLightShot = 0; self.update = function () { // Hero update method - no automatic firing }; return self; }); var LightOrb = Container.expand(function () { var self = Container.call(this); var orbGraphics = self.attachAsset('lightOrb', { anchorX: 0.5, anchorY: 0.5 }); self.bobOffset = Math.random() * Math.PI * 2; self.baseY = self.y; self.update = function () { self.y = self.baseY + Math.sin(LK.ticks * 0.1 + self.bobOffset) * 10; }; return self; }); var LightProjectile = Container.expand(function () { var self = Container.call(this); var projectileGraphics = self.attachAsset('lightProjectile', { anchorX: 0.5, anchorY: 0.5 }); self.velocityX = 0; self.velocityY = 0; self.lifetime = 180; // 3 seconds at 60fps self.update = function () { self.x += self.velocityX; self.y += self.velocityY; self.lifetime--; }; return self; }); var Shadow = Container.expand(function () { var self = Container.call(this); var shadowGraphics = self.attachAsset('shadow', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1 + Math.random() * 2; self.health = 2; self.update = function () { var angle = Math.atan2(hero.y - self.y, hero.x - self.x); self.x += Math.cos(angle) * self.speed; self.y += Math.sin(angle) * self.speed; }; return self; }); var SplitterShadow = Container.expand(function () { var self = Container.call(this); var shadowGraphics = self.attachAsset('splitterShadow', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1.5 + Math.random() * 1; self.health = 3; self.monsterType = 'splitter'; self.update = function () { var angle = Math.atan2(hero.y - self.y, hero.x - self.x); self.x += Math.cos(angle) * self.speed; self.y += Math.sin(angle) * self.speed; // Pulsing effect var pulse = 1 + Math.sin(LK.ticks * 0.3) * 0.2; shadowGraphics.scaleX = pulse; shadowGraphics.scaleY = pulse; }; return self; }); var TankShadow = Container.expand(function () { var self = Container.call(this); var shadowGraphics = self.attachAsset('tankShadow', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 0.5 + Math.random() * 0.5; self.health = 8; self.maxHealth = 8; self.monsterType = 'tank'; self.update = function () { var angle = Math.atan2(hero.y - self.y, hero.x - self.x); self.x += Math.cos(angle) * self.speed; self.y += Math.sin(angle) * self.speed; // Visual health indicator var healthPercent = self.health / self.maxHealth; shadowGraphics.alpha = 0.5 + healthPercent * 0.5; }; return self; }); var TeleporterShadow = Container.expand(function () { var self = Container.call(this); var shadowGraphics = self.attachAsset('teleporterShadow', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1 + Math.random() * 1; self.health = 2; self.monsterType = 'teleporter'; self.lastTeleport = 0; self.teleportCooldown = 180; // 3 seconds self.update = function () { var angle = Math.atan2(hero.y - self.y, hero.x - self.x); var distanceToHero = Math.sqrt(Math.pow(hero.x - self.x, 2) + Math.pow(hero.y - self.y, 2)); // Teleport if far from hero and cooldown is ready if (distanceToHero > 300 && LK.ticks - self.lastTeleport > self.teleportCooldown) { var teleportDistance = 150; var teleportAngle = Math.atan2(hero.y - self.y, hero.x - self.x); self.x = hero.x - Math.cos(teleportAngle) * teleportDistance; self.y = hero.y - Math.sin(teleportAngle) * teleportDistance; self.lastTeleport = LK.ticks; LK.effects.flashObject(self, 0x8844ff, 300); } else { // Normal movement self.x += Math.cos(angle) * self.speed; self.y += Math.sin(angle) * self.speed; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Create single cube background var cube = LK.getAsset('cube', { anchorX: 0.5, anchorY: 0.5 }); cube.x = 1024; cube.y = 1366; game.addChild(cube); var hero = game.addChild(new Hero()); hero.x = 1024; hero.y = 1366; var shadows = []; var lightProjectiles = []; var fireSpells = []; var lightOrbs = []; var lastShadowSpawn = 0; var shadowSpawnRate = 120; // Start spawning every 2 seconds var waveLevel = 1; var score = 0; var lastFireSpell = 0; var fireSpellCooldown = 90; // 1.5 seconds cooldown at 60fps var maxActiveFireSpells = 3; var lastLightAttack = 0; var lightAttackCooldown = 720; // 12 seconds cooldown at 60fps var scoreTxt = new Text2('Score: 0', { size: 60, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Create fire button var fireButton = LK.getAsset('fireSpell', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.2, scaleY: 1.2, alpha: 0.8 }); fireButton.x = 200; fireButton.y = 2500; game.addChild(fireButton); // Create light attack button var lightButton = LK.getAsset('lightOrb', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.8, scaleY: 1.8, alpha: 0.8 }); lightButton.x = 1800; lightButton.y = 2500; game.addChild(lightButton); // Create light projectile button var lightProjectileButton = LK.getAsset('lightProjectile', { anchorX: 0.5, anchorY: 0.5, scaleX: 2.0, scaleY: 2.0, alpha: 0.8 }); lightProjectileButton.x = 1024; lightProjectileButton.y = 2500; game.addChild(lightProjectileButton); // Fire button press handler fireButton.down = function (x, y, obj) { // Fire spell at nearest enemy - check cooldown and limit var timeSinceLastFire = LK.ticks - lastFireSpell; if (timeSinceLastFire >= fireSpellCooldown && fireSpells.length < maxActiveFireSpells && shadows.length > 0) { // Find nearest shadow var nearestShadow = null; var nearestDistance = Infinity; for (var i = 0; i < shadows.length; i++) { var distance = Math.sqrt(Math.pow(hero.x - shadows[i].x, 2) + Math.pow(hero.y - shadows[i].y, 2)); if (distance < nearestDistance) { nearestDistance = distance; nearestShadow = shadows[i]; } } ; // Light attack button press handler lightButton.down = function (x, y, obj) { // Check cooldown var timeSinceLastLight = LK.ticks - lastLightAttack; if (timeSinceLastLight >= lightAttackCooldown) { // Destroy all enemies on screen for (var i = shadows.length - 1; i >= 0; i--) { var shadow = shadows[i]; // Create light orb for each destroyed shadow var newOrb = new LightOrb(); newOrb.x = shadow.x; newOrb.y = shadow.y; newOrb.baseY = newOrb.y; lightOrbs.push(newOrb); game.addChild(newOrb); // Add score based on monster type var scoreValue = shadow.monsterType === 'tank' ? 25 : shadow.monsterType === 'splitter' ? 30 : shadow.monsterType === 'teleporter' ? 20 : shadow.monsterType === 'bomber' ? 35 : 10; score += scoreValue; // Flash effect on each enemy before destruction tween(shadow, { alpha: 0 }, { duration: 200, onFinish: function onFinish() { shadow.destroy(); } }); shadows.splice(i, 1); } // Update score display scoreTxt.setText('Score: ' + score); // Play sound effect LK.getSound('shadowDestroy').play(); // Screen flash effect LK.effects.flashScreen(0xffffaa, 800); // Button feedback with cooldown visual LK.effects.flashObject(lightButton, 0xffffaa, 400); tween(lightButton, { alpha: 0.3 }, { duration: 0 }); tween(lightButton, { alpha: 0.8 }, { duration: lightAttackCooldown * 16.67 }); // Convert ticks to ms // Update cooldown lastLightAttack = LK.ticks; } }; // Light projectile button press handler lightProjectileButton.down = function (x, y, obj) { // Fire light projectile var newProjectile = new LightProjectile(); newProjectile.x = hero.x; newProjectile.y = hero.y; // Fire in 8 directions var directions = 8; for (var i = 0; i < directions; i++) { var angle = i / directions * Math.PI * 2; var projectile = new LightProjectile(); projectile.x = hero.x; projectile.y = hero.y; projectile.velocityX = Math.cos(angle) * 8; projectile.velocityY = Math.sin(angle) * 8; lightProjectiles.push(projectile); game.addChild(projectile); } // Button feedback LK.effects.flashObject(lightProjectileButton, 0xffffaa, 200); }; if (nearestShadow) { var newFireSpell = new FireSpell(); newFireSpell.x = nearestShadow.x; newFireSpell.y = nearestShadow.y; fireSpells.push(newFireSpell); game.addChild(newFireSpell); lastFireSpell = LK.ticks; LK.getSound('fireBlast').play(); // Button feedback LK.effects.flashObject(fireButton, 0xff4400, 200); } } }; var dragNode = null; function handleMove(x, y, obj) { if (dragNode) { dragNode.x = x; dragNode.y = y; // Keep hero within bounds if (dragNode.x < 40) dragNode.x = 40; if (dragNode.x > 2008) dragNode.x = 2008; if (dragNode.y < 40) dragNode.y = 40; if (dragNode.y > 2692) dragNode.y = 2692; } } game.move = handleMove; game.down = function (x, y, obj) { // Check if touching hero var heroDistance = Math.sqrt(Math.pow(x - hero.x, 2) + Math.pow(y - hero.y, 2)); if (heroDistance < 60) { dragNode = hero; handleMove(x, y, obj); } }; game.up = function (x, y, obj) { dragNode = null; }; game.update = function () { // Spawn shadows if (LK.ticks - lastShadowSpawn >= shadowSpawnRate) { var newShadow; // Choose random monster type based on wave level var monsterRoll = Math.random(); if (waveLevel < 3) { // Early waves: mostly basic shadows if (monsterRoll < 0.7) newShadow = new Shadow();else if (monsterRoll < 0.9) newShadow = new FastShadow();else newShadow = new TankShadow(); } else if (waveLevel < 6) { // Mid waves: introduce more variety if (monsterRoll < 0.4) newShadow = new Shadow();else if (monsterRoll < 0.6) newShadow = new FastShadow();else if (monsterRoll < 0.75) newShadow = new TankShadow();else if (monsterRoll < 0.9) newShadow = new SplitterShadow();else newShadow = new TeleporterShadow(); } else { // Late waves: all monster types including dangerous ones if (monsterRoll < 0.25) newShadow = new Shadow();else if (monsterRoll < 0.4) newShadow = new FastShadow();else if (monsterRoll < 0.55) newShadow = new TankShadow();else if (monsterRoll < 0.7) newShadow = new SplitterShadow();else if (monsterRoll < 0.85) newShadow = new TeleporterShadow();else newShadow = new BomberShadow(); } // Spawn from random edge var edge = Math.floor(Math.random() * 4); switch (edge) { case 0: // Top newShadow.x = Math.random() * 2048; newShadow.y = -30; break; case 1: // Right newShadow.x = 2078; newShadow.y = Math.random() * 2732; break; case 2: // Bottom newShadow.x = Math.random() * 2048; newShadow.y = 2762; break; case 3: // Left newShadow.x = -30; newShadow.y = Math.random() * 2732; break; } newShadow.speed += waveLevel * 0.3; shadows.push(newShadow); game.addChild(newShadow); lastShadowSpawn = LK.ticks; } // Check hero collision with shadows for (var i = 0; i < shadows.length; i++) { var shadow = shadows[i]; if (hero.intersects(shadow)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } // Check bomber explosions if (shadow.monsterType === 'bomber' && shadow.exploding && shadow.explosionTimer <= 0) { var explosionDistance = Math.sqrt(Math.pow(hero.x - shadow.x, 2) + Math.pow(hero.y - shadow.y, 2)); if (explosionDistance < 120) { LK.effects.flashScreen(0xff4400, 1000); LK.showGameOver(); return; } // Remove exploded bomber shadow.destroy(); shadows.splice(i, 1); i--; // Adjust index after removal } } // Update and check light projectiles for (var j = lightProjectiles.length - 1; j >= 0; j--) { var projectile = lightProjectiles[j]; if (projectile.lifetime <= 0 || projectile.x < -50 || projectile.x > 2098 || projectile.y < -50 || projectile.y > 2782) { projectile.destroy(); lightProjectiles.splice(j, 1); continue; } // Check collision with shadows for (var k = shadows.length - 1; k >= 0; k--) { if (projectile.intersects(shadows[k])) { var shadow = shadows[k]; shadow.health--; var shadowDestroyed = false; if (shadow.health <= 0) { // Handle special monster behaviors on death if (shadow.monsterType === 'splitter' && shadow.health <= 0) { // Create two smaller fast shadows for (var split = 0; split < 2; split++) { var miniShadow = new FastShadow(); miniShadow.x = shadow.x + (split === 0 ? -30 : 30); miniShadow.y = shadow.y + (Math.random() - 0.5) * 60; miniShadow.speed *= 0.8; shadows.push(miniShadow); game.addChild(miniShadow); } } if (shadow.monsterType === 'bomber' && shadow.exploding && shadow.explosionTimer > 0) { // Bomber was destroyed while exploding, cancel explosion shadow.exploding = false; } // Create light orb var newOrb = new LightOrb(); newOrb.x = shadow.x; newOrb.y = shadow.y; newOrb.baseY = newOrb.y; lightOrbs.push(newOrb); game.addChild(newOrb); shadow.destroy(); shadows.splice(k, 1); shadowDestroyed = true; var scoreValue = shadow.monsterType === 'tank' ? 25 : shadow.monsterType === 'splitter' ? 30 : shadow.monsterType === 'teleporter' ? 20 : shadow.monsterType === 'bomber' ? 35 : 10; score += scoreValue; scoreTxt.setText('Score: ' + score); LK.getSound('shadowDestroy').play(); } else { // Monster took damage but not destroyed LK.effects.flashObject(shadow, 0xffffff, 200); } projectile.destroy(); lightProjectiles.splice(j, 1); break; } } } // Update and check fire spells for (var l = fireSpells.length - 1; l >= 0; l--) { var spell = fireSpells[l]; if (spell.lifetime <= 0) { spell.destroy(); fireSpells.splice(l, 1); continue; } // Check collision with shadows for (var m = shadows.length - 1; m >= 0; m--) { var distance = Math.sqrt(Math.pow(spell.x - shadows[m].x, 2) + Math.pow(spell.y - shadows[m].y, 2)); if (distance < spell.radius) { var shadow = shadows[m]; shadow.health -= 2; // Fire spells do more damage if (shadow.health <= 0) { // Handle special monster behaviors on death if (shadow.monsterType === 'splitter') { // Create two smaller fast shadows for (var split = 0; split < 2; split++) { var miniShadow = new FastShadow(); miniShadow.x = shadow.x + (split === 0 ? -30 : 30); miniShadow.y = shadow.y + (Math.random() - 0.5) * 60; miniShadow.speed *= 0.8; shadows.push(miniShadow); game.addChild(miniShadow); } } if (shadow.monsterType === 'bomber' && shadow.exploding && shadow.explosionTimer > 0) { // Bomber was destroyed while exploding, cancel explosion shadow.exploding = false; } // Create light orb var newOrb = new LightOrb(); newOrb.x = shadow.x; newOrb.y = shadow.y; newOrb.baseY = newOrb.y; lightOrbs.push(newOrb); game.addChild(newOrb); shadow.destroy(); shadows.splice(m, 1); var scoreValue = shadow.monsterType === 'tank' ? 30 : shadow.monsterType === 'splitter' ? 35 : shadow.monsterType === 'teleporter' ? 25 : shadow.monsterType === 'bomber' ? 40 : 15; score += scoreValue; scoreTxt.setText('Score: ' + score); LK.getSound('shadowDestroy').play(); } else { // Monster took damage but not destroyed LK.effects.flashObject(shadow, 0xff8800, 200); } } } } // Check light orb collection for (var n = lightOrbs.length - 1; n >= 0; n--) { var orb = lightOrbs[n]; if (hero.intersects(orb)) { hero.lightPower++; if (hero.fireRate > 20) { hero.fireRate -= 2; } orb.destroy(); lightOrbs.splice(n, 1); LK.getSound('collectOrb').play(); // Flash hero with light effect LK.effects.flashObject(hero, 0xffffaa, 500); } } // Increase difficulty over time if (LK.ticks % 1800 === 0) { // Every 30 seconds waveLevel++; if (shadowSpawnRate > 30) { shadowSpawnRate -= 10; } } // Victory condition if (score >= 500) { LK.showYouWin(); } };
===================================================================
--- original.js
+++ change.js
@@ -274,8 +274,19 @@
});
lightButton.x = 1800;
lightButton.y = 2500;
game.addChild(lightButton);
+// Create light projectile button
+var lightProjectileButton = LK.getAsset('lightProjectile', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 2.0,
+ scaleY: 2.0,
+ alpha: 0.8
+});
+lightProjectileButton.x = 1024;
+lightProjectileButton.y = 2500;
+game.addChild(lightProjectileButton);
// Fire button press handler
fireButton.down = function (x, y, obj) {
// Fire spell at nearest enemy - check cooldown and limit
var timeSinceLastFire = LK.ticks - lastFireSpell;
@@ -341,8 +352,29 @@
// Update cooldown
lastLightAttack = LK.ticks;
}
};
+ // Light projectile button press handler
+ lightProjectileButton.down = function (x, y, obj) {
+ // Fire light projectile
+ var newProjectile = new LightProjectile();
+ newProjectile.x = hero.x;
+ newProjectile.y = hero.y;
+ // Fire in 8 directions
+ var directions = 8;
+ for (var i = 0; i < directions; i++) {
+ var angle = i / directions * Math.PI * 2;
+ var projectile = new LightProjectile();
+ projectile.x = hero.x;
+ projectile.y = hero.y;
+ projectile.velocityX = Math.cos(angle) * 8;
+ projectile.velocityY = Math.sin(angle) * 8;
+ lightProjectiles.push(projectile);
+ game.addChild(projectile);
+ }
+ // Button feedback
+ LK.effects.flashObject(lightProjectileButton, 0xffffaa, 200);
+ };
if (nearestShadow) {
var newFireSpell = new FireSpell();
newFireSpell.x = nearestShadow.x;
newFireSpell.y = nearestShadow.y;
bola de fuego de pixeles. In-Game asset. 2d. High contrast. No shadows
monstruo de slime negro de pixeles. In-Game asset. 2d. High contrast. No shadows
suelo de sesped oscuro de pixeles. In-Game asset. 2d. High contrast. No shadows
bola de luz de pixeles. In-Game asset. 2d. High contrast. No shadows
sombra de pixeles que de miedo. In-Game asset. 2d. High contrast. No shadows
portal de pixeles de luz. In-Game asset. 2d. High contrast. No shadows
angel en forma de ojo de pixeles. In-Game asset. 2d. High contrast. No shadows
que ahora tenga una exprecion de determinacion
fuego negro de pixeles. In-Game asset. 2d. High contrast. No shadows
bola de luz azul de pixeles. In-Game asset. 2d. High contrast. No shadows
la muerte de pixeles. In-Game asset. 2d. High contrast. No shadows
orbe oscuro de pixeles con cara enojada. In-Game asset. 2d. High contrast. No shadows
berserquer de pixeles. In-Game asset. 2d. High contrast. No shadows
sombra mimica de pixeles. In-Game asset. 2d. High contrast. No shadows
casa de madera con barricadas de pixeles. In-Game asset. 2d. High contrast. No shadows
bola de hielo de pixeles. In-Game asset. 2d. High contrast. No shadows
bola de viento de pixeles. In-Game asset. 2d. High contrast. No shadows