User prompt
Que los científicos rápidos aparezcan cada 10 científicos normales y tengan el doble de resistencia que uno normal
User prompt
Necesitamos agarrar 1000 residuos de científicos para poder cambiar a el rayo, el cuchillo mata a un científico con 5 y el rayo con 2
User prompt
Que el número de proyectiles sean de 3 por segundo
User prompt
Los proyectiles que sean el doble de su tamaño actual
User prompt
Que el perro no cambie de color al agarrar un objeto
User prompt
Los proyectiles no se ven, hazlos visibles haciéndolos el triple de grande de si mismos
User prompt
Los científicos tienen que ser más grandes que el perro, lo residuos de los científicos del mismo tamaño que los proyectiles, tamaño como la mitad del perro
User prompt
Que no estén amontonados y lo suficientemente grandes para que el dedo meñique quepa
User prompt
Haz los botones más grandes
User prompt
Agrega botones con las principales direcciones, al aplastarlos los proyectiles se lanzan a esa dirección
User prompt
Al agarrar los cofres que aparezcan en la pantalla recompensas como oro o mejoras para nuestra arma, además que podamos disparar hacia atrás, para eso coloca cuatro botones con l direcciónes derecha, izquierda, enfrente y atrás, al apretarlos los proyectiles del rma se cambiarán a esa dirección, iniciaremos solo lanzando cuchillo, a medida que matemos a ma científicos y agarremos la recompensas evolucionaremos a un rayo láser
User prompt
Que el perro sea mas grande y que los científicos al morir suelten metales, cofres y tecnología que podamos agarrar
Code edit (1 edits merged)
Please save this source code
User prompt
Dog vs Scientists
Initial prompt
Juego donde una cabeza de perro que lucha contra unos científicos
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Chest = Container.expand(function () { var self = Container.call(this); var chestGraphics = self.attachAsset('chest', { anchorX: 0.5, anchorY: 0.5 }); self.type = 'chest'; self.value = 20; self.update = function () { self.rotation += 0.03; }; return self; }); var Dog = Container.expand(function () { var self = Container.call(this); var dogGraphics = self.attachAsset('dog', { anchorX: 0.5, anchorY: 0.5 }); self.health = 3; self.maxHealth = 3; self.shootCooldown = 0; self.shootRate = 15; self.speed = 5; self.powerUpActive = false; self.powerUpEndTime = 0; self.update = function () { if (self.shootCooldown > 0) { self.shootCooldown--; } if (self.powerUpActive && LK.now > self.powerUpEndTime) { self.powerUpActive = false; self.speed = 5; self.shootRate = 15; dogGraphics.tint = 0xFFFFFF; } }; self.shoot = function () { if (self.shootCooldown <= 0) { var bullet = new DogBullet(); bullet.x = self.x; bullet.y = self.y - 60; bullets.push(bullet); game.addChild(bullet); self.shootCooldown = self.shootRate; LK.getSound('shoot').play(); } }; self.takeDamage = function () { self.health--; LK.effects.flashObject(self, 0xFF0000, 500); if (self.health <= 0) { LK.showGameOver(); } }; self.activatePowerUp = function () { self.powerUpActive = true; self.powerUpEndTime = LK.now + 5000; self.speed = 8; self.shootRate = 8; dogGraphics.tint = 0x00FFFF; }; return self; }); var DogBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('dogBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.damage = 1; self.update = function () { self.y -= self.speed; }; return self; }); var FastScientist = Container.expand(function () { var self = Container.call(this); var scientistGraphics = self.attachAsset('fastScientist', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 3.5; self.health = 1; self.points = 20; self.targetX = 0; self.targetY = 0; self.update = function () { var dx = self.targetX - self.x; var dy = self.targetY - 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; } }; self.takeDamage = function (damage) { self.health -= damage; if (self.health <= 0) { return true; } return false; }; return self; }); var Metal = Container.expand(function () { var self = Container.call(this); var metalGraphics = self.attachAsset('metal', { anchorX: 0.5, anchorY: 0.5 }); self.type = 'metal'; self.value = 5; self.update = function () { self.rotation += 0.05; }; return self; }); var PowerUp = Container.expand(function () { var self = Container.call(this); var powerUpGraphics = self.attachAsset('powerUp', { anchorX: 0.5, anchorY: 0.5 }); self.type = 'speed'; self.duration = 5000; self.update = function () { self.rotation += 0.1; }; return self; }); var Scientist = Container.expand(function () { var self = Container.call(this); var scientistGraphics = self.attachAsset('scientist', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2; self.health = 1; self.points = 10; self.targetX = 0; self.targetY = 0; self.update = function () { var dx = self.targetX - self.x; var dy = self.targetY - 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; } }; self.takeDamage = function (damage) { self.health -= damage; if (self.health <= 0) { return true; } return false; }; return self; }); var Technology = Container.expand(function () { var self = Container.call(this); var technologyGraphics = self.attachAsset('technology', { anchorX: 0.5, anchorY: 0.5 }); self.type = 'technology'; self.value = 50; self.update = function () { self.rotation += 0.08; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a2e }); /**** * Game Code ****/ var dog = new Dog(); var bullets = []; var scientists = []; var powerUps = []; var metals = []; var chests = []; var technologies = []; var spawnTimer = 0; var waveTimer = 0; var difficultyLevel = 1; var lastSpawnRate = 120; dog.x = 1024; dog.y = 2200; game.addChild(dog); var scoreTxt = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var healthTxt = new Text2('Health: 3', { size: 60, fill: 0xFF0000 }); healthTxt.anchor.set(0, 0); healthTxt.x = 150; healthTxt.y = 50; LK.gui.topLeft.addChild(healthTxt); var dragNode = null; function updateScore() { scoreTxt.setText('Score: ' + LK.getScore()); } function updateHealth() { healthTxt.setText('Health: ' + dog.health); } function spawnScientist() { var scientist; if (Math.random() < 0.3 && difficultyLevel > 2) { scientist = new FastScientist(); } else { scientist = new Scientist(); } var side = Math.floor(Math.random() * 4); switch (side) { case 0: // Top scientist.x = Math.random() * 2048; scientist.y = -40; break; case 1: // Right scientist.x = 2088; scientist.y = Math.random() * 2732; break; case 2: // Bottom scientist.x = Math.random() * 2048; scientist.y = 2772; break; case 3: // Left scientist.x = -40; scientist.y = Math.random() * 2732; break; } scientist.targetX = dog.x; scientist.targetY = dog.y; scientists.push(scientist); game.addChild(scientist); } function spawnPowerUp() { if (Math.random() < 0.02 && powerUps.length < 2) { var powerUp = new PowerUp(); powerUp.x = Math.random() * 1800 + 124; powerUp.y = Math.random() * 2400 + 166; powerUps.push(powerUp); game.addChild(powerUp); } } function spawnLoot(x, y) { var lootChance = Math.random(); var loot; if (lootChance < 0.5) { // 50% chance for metal loot = new Metal(); metals.push(loot); } else if (lootChance < 0.8) { // 30% chance for chest loot = new Chest(); chests.push(loot); } else { // 20% chance for technology loot = new Technology(); technologies.push(loot); } loot.x = x; loot.y = y; game.addChild(loot); } function handleMove(x, y, obj) { if (dragNode) { dragNode.x = Math.max(60, Math.min(1988, x)); dragNode.y = Math.max(60, Math.min(2672, y)); } } game.move = handleMove; game.down = function (x, y, obj) { dragNode = dog; dog.shoot(); handleMove(x, y, obj); }; game.up = function (x, y, obj) { dragNode = null; }; game.update = function () { spawnTimer++; waveTimer++; if (waveTimer % 1800 === 0) { difficultyLevel++; lastSpawnRate = Math.max(30, lastSpawnRate - 10); } if (spawnTimer >= lastSpawnRate) { spawnScientist(); spawnTimer = 0; } spawnPowerUp(); for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; if (bullet.y < -50) { bullet.destroy(); bullets.splice(i, 1); continue; } for (var j = scientists.length - 1; j >= 0; j--) { var scientist = scientists[j]; if (bullet.intersects(scientist)) { if (scientist.takeDamage(bullet.damage)) { LK.setScore(LK.getScore() + scientist.points); updateScore(); spawnLoot(scientist.x, scientist.y); scientist.destroy(); scientists.splice(j, 1); LK.getSound('hit').play(); } bullet.destroy(); bullets.splice(i, 1); break; } } } for (var k = scientists.length - 1; k >= 0; k--) { var scientist = scientists[k]; scientist.targetX = dog.x; scientist.targetY = dog.y; if (scientist.intersects(dog)) { dog.takeDamage(); updateHealth(); scientist.destroy(); scientists.splice(k, 1); continue; } var distanceToEdge = Math.min(scientist.x, 2048 - scientist.x, scientist.y, 2732 - scientist.y); if (distanceToEdge < -100) { scientist.destroy(); scientists.splice(k, 1); } } for (var l = powerUps.length - 1; l >= 0; l--) { var powerUp = powerUps[l]; if (powerUp.intersects(dog)) { dog.activatePowerUp(); LK.getSound('powerup').play(); powerUp.destroy(); powerUps.splice(l, 1); } } // Check metal collection for (var m = metals.length - 1; m >= 0; m--) { var metal = metals[m]; if (metal.intersects(dog)) { LK.setScore(LK.getScore() + metal.value); updateScore(); metal.destroy(); metals.splice(m, 1); } } // Check chest collection for (var c = chests.length - 1; c >= 0; c--) { var chest = chests[c]; if (chest.intersects(dog)) { LK.setScore(LK.getScore() + chest.value); updateScore(); chest.destroy(); chests.splice(c, 1); } } // Check technology collection for (var t = technologies.length - 1; t >= 0; t--) { var technology = technologies[t]; if (technology.intersects(dog)) { LK.setScore(LK.getScore() + technology.value); updateScore(); technology.destroy(); technologies.splice(t, 1); } } if (LK.ticks % 10 === 0 && dog.powerUpActive) { dog.shoot(); } }; LK.playMusic('bgmusic');
===================================================================
--- original.js
+++ change.js
@@ -5,8 +5,21 @@
/****
* Classes
****/
+var Chest = Container.expand(function () {
+ var self = Container.call(this);
+ var chestGraphics = self.attachAsset('chest', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.type = 'chest';
+ self.value = 20;
+ self.update = function () {
+ self.rotation += 0.03;
+ };
+ return self;
+});
var Dog = Container.expand(function () {
var self = Container.call(this);
var dogGraphics = self.attachAsset('dog', {
anchorX: 0.5,
@@ -98,8 +111,21 @@
return false;
};
return self;
});
+var Metal = Container.expand(function () {
+ var self = Container.call(this);
+ var metalGraphics = self.attachAsset('metal', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.type = 'metal';
+ self.value = 5;
+ self.update = function () {
+ self.rotation += 0.05;
+ };
+ return self;
+});
var PowerUp = Container.expand(function () {
var self = Container.call(this);
var powerUpGraphics = self.attachAsset('powerUp', {
anchorX: 0.5,
@@ -140,8 +166,21 @@
return false;
};
return self;
});
+var Technology = Container.expand(function () {
+ var self = Container.call(this);
+ var technologyGraphics = self.attachAsset('technology', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.type = 'technology';
+ self.value = 50;
+ self.update = function () {
+ self.rotation += 0.08;
+ };
+ return self;
+});
/****
* Initialize Game
****/
@@ -155,8 +194,11 @@
var dog = new Dog();
var bullets = [];
var scientists = [];
var powerUps = [];
+var metals = [];
+var chests = [];
+var technologies = [];
var spawnTimer = 0;
var waveTimer = 0;
var difficultyLevel = 1;
var lastSpawnRate = 120;
@@ -227,8 +269,28 @@
powerUps.push(powerUp);
game.addChild(powerUp);
}
}
+function spawnLoot(x, y) {
+ var lootChance = Math.random();
+ var loot;
+ if (lootChance < 0.5) {
+ // 50% chance for metal
+ loot = new Metal();
+ metals.push(loot);
+ } else if (lootChance < 0.8) {
+ // 30% chance for chest
+ loot = new Chest();
+ chests.push(loot);
+ } else {
+ // 20% chance for technology
+ loot = new Technology();
+ technologies.push(loot);
+ }
+ loot.x = x;
+ loot.y = y;
+ game.addChild(loot);
+}
function handleMove(x, y, obj) {
if (dragNode) {
dragNode.x = Math.max(60, Math.min(1988, x));
dragNode.y = Math.max(60, Math.min(2672, y));
@@ -267,8 +329,9 @@
if (bullet.intersects(scientist)) {
if (scientist.takeDamage(bullet.damage)) {
LK.setScore(LK.getScore() + scientist.points);
updateScore();
+ spawnLoot(scientist.x, scientist.y);
scientist.destroy();
scientists.splice(j, 1);
LK.getSound('hit').play();
}
@@ -303,8 +366,38 @@
powerUp.destroy();
powerUps.splice(l, 1);
}
}
+ // Check metal collection
+ for (var m = metals.length - 1; m >= 0; m--) {
+ var metal = metals[m];
+ if (metal.intersects(dog)) {
+ LK.setScore(LK.getScore() + metal.value);
+ updateScore();
+ metal.destroy();
+ metals.splice(m, 1);
+ }
+ }
+ // Check chest collection
+ for (var c = chests.length - 1; c >= 0; c--) {
+ var chest = chests[c];
+ if (chest.intersects(dog)) {
+ LK.setScore(LK.getScore() + chest.value);
+ updateScore();
+ chest.destroy();
+ chests.splice(c, 1);
+ }
+ }
+ // Check technology collection
+ for (var t = technologies.length - 1; t >= 0; t--) {
+ var technology = technologies[t];
+ if (technology.intersects(dog)) {
+ LK.setScore(LK.getScore() + technology.value);
+ updateScore();
+ technology.destroy();
+ technologies.splice(t, 1);
+ }
+ }
if (LK.ticks % 10 === 0 && dog.powerUpActive) {
dog.shoot();
}
};
Cabeza de perro labrador. In-Game asset. 2d. High contrast. No shadows
Láser azul. In-Game asset. 2d. High contrast. No shadows
Perrobala. In-Game asset. 2d. High contrast. No shadows
Huella de perro. In-Game asset. 2d. High contrast. No shadows
Vista desde arriba de un laboratorio. In-Game asset. 2d. High contrast. No shadows