User prompt
Has que "Theme" suene de fondo siempre
User prompt
Haz que nada más tocar un demogorgon pierdas
User prompt
Haz que la batería de la luz duerme un poco más
User prompt
Añade una barra que indique cuanto me queda de vida y energía y haz que el demogorgon se mueva más rápido ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Haz el código ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Hazlo más difícil. Que el demogorgon ataque más
Code edit (1 edits merged)
Please save this source code
User prompt
Upside Down Survival
Initial prompt
Create a RPG about suriviving in Stranger Things's upside down
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Battery = Container.expand(function () {
var self = Container.call(this);
var batteryGraphics = self.attachAsset('battery', {
anchorX: 0.5,
anchorY: 0.5
});
self.value = 25;
return self;
});
var Demogorgon = Container.expand(function () {
var self = Container.call(this);
var demoGraphics = self.attachAsset('demogorgon', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 1;
self.targetX = 0;
self.targetY = 0;
self.huntRadius = 400;
self.update = function () {
if (player && flashlight.alpha > 0.1) {
var dx = player.x - self.x;
var dy = player.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < self.huntRadius) {
self.targetX = player.x;
self.targetY = player.y;
}
}
var moveX = self.targetX - self.x;
var moveY = self.targetY - self.y;
var moveDistance = Math.sqrt(moveX * moveX + moveY * moveY);
if (moveDistance > 5) {
self.x += moveX / moveDistance * self.speed;
self.y += moveY / moveDistance * self.speed;
}
};
return self;
});
var HealthKit = Container.expand(function () {
var self = Container.call(this);
var healthGraphics = self.attachAsset('healthKit', {
anchorX: 0.5,
anchorY: 0.5
});
self.value = 30;
return self;
});
var HideSpot = Container.expand(function () {
var self = Container.call(this);
var hideGraphics = self.attachAsset('hideSpot', {
anchorX: 0.5,
anchorY: 0.5
});
hideGraphics.alpha = 0.6;
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.batteryLevel = 100;
self.isHiding = false;
self.maxBatteryLevel = 100;
self.takeDamage = function (amount) {
if (!self.isHiding) {
self.health -= amount;
if (self.health <= 0) {
self.health = 0;
}
}
};
self.heal = function (amount) {
self.health = Math.min(100, self.health + amount);
};
self.addBattery = function (amount) {
self.batteryLevel = Math.min(self.maxBatteryLevel, self.batteryLevel + amount);
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x0a0a0a
});
/****
* Game Code
****/
var player = null;
var flashlight = null;
var demogorgons = [];
var batteries = [];
var healthKits = [];
var hideSpots = [];
var waveNumber = 1;
var itemSpawnTimer = 0;
var demoSpawnTimer = 0;
var batteryDrainTimer = 0;
var damageTimer = 0;
// UI Elements
var healthText = new Text2('Health: 100', {
size: 40,
fill: 0xFF0000
});
healthText.anchor.set(0, 0);
healthText.x = 120;
healthText.y = 20;
LK.gui.topLeft.addChild(healthText);
var batteryText = new Text2('Battery: 100%', {
size: 40,
fill: 0xFFFF00
});
batteryText.anchor.set(0, 0);
batteryText.x = 120;
batteryText.y = 70;
LK.gui.topLeft.addChild(batteryText);
var waveText = new Text2('Wave: 1', {
size: 50,
fill: 0xFFFFFF
});
waveText.anchor.set(0.5, 0);
LK.gui.top.addChild(waveText);
// Initialize player
player = game.addChild(new Player());
player.x = 1024;
player.y = 1366;
// Initialize flashlight
flashlight = game.addChild(LK.getAsset('lightCircle', {
anchorX: 0.5,
anchorY: 0.5
}));
flashlight.alpha = 0.3;
flashlight.x = player.x;
flashlight.y = player.y;
// Create initial hide spots
function spawnHideSpots() {
for (var i = 0; i < 6; i++) {
var hideSpot = game.addChild(new HideSpot());
hideSpot.x = Math.random() * 1800 + 200;
hideSpot.y = Math.random() * 2400 + 200;
hideSpots.push(hideSpot);
}
}
function spawnBattery() {
var battery = game.addChild(new Battery());
battery.x = Math.random() * 1800 + 200;
battery.y = Math.random() * 2400 + 200;
batteries.push(battery);
}
function spawnHealthKit() {
var healthKit = game.addChild(new HealthKit());
healthKit.x = Math.random() * 1800 + 200;
healthKit.y = Math.random() * 2400 + 200;
healthKits.push(healthKit);
}
function spawnDemogorgon() {
var demo = game.addChild(new Demogorgon());
var edge = Math.floor(Math.random() * 4);
switch (edge) {
case 0:
// Top
demo.x = Math.random() * 2048;
demo.y = -100;
break;
case 1:
// Right
demo.x = 2148;
demo.y = Math.random() * 2732;
break;
case 2:
// Bottom
demo.x = Math.random() * 2048;
demo.y = 2832;
break;
case 3:
// Left
demo.x = -100;
demo.y = Math.random() * 2732;
break;
}
demo.targetX = demo.x;
demo.targetY = demo.y;
demogorgons.push(demo);
}
// Initialize starting items
spawnHideSpots();
spawnBattery();
spawnBattery();
spawnHealthKit();
game.down = function (x, y, obj) {
tween(player, {
x: x,
y: y
}, {
duration: 500
});
};
game.update = function () {
// Update flashlight position
flashlight.x = player.x;
flashlight.y = player.y;
// Battery drain
batteryDrainTimer++;
if (batteryDrainTimer >= 60) {
// Every second
player.batteryLevel = Math.max(0, player.batteryLevel - 1);
batteryDrainTimer = 0;
}
// Adjust flashlight based on battery
if (player.batteryLevel <= 0) {
flashlight.alpha = 0;
// Player takes damage in darkness
damageTimer++;
if (damageTimer >= 120) {
// Every 2 seconds
player.takeDamage(10);
LK.getSound('damage').play();
damageTimer = 0;
}
} else {
flashlight.alpha = 0.3;
damageTimer = 0;
}
// Check if player is hiding
player.isHiding = false;
for (var h = 0; h < hideSpots.length; h++) {
if (player.intersects(hideSpots[h])) {
player.isHiding = true;
flashlight.alpha = Math.min(0.1, flashlight.alpha);
break;
}
}
// Update demogorgons
for (var d = demogorgons.length - 1; d >= 0; d--) {
var demo = demogorgons[d];
// Check collision with player
if (demo.intersects(player)) {
player.takeDamage(25);
LK.getSound('damage').play();
LK.effects.flashScreen(0xff0000, 300);
// Remove demogorgon after attack
demo.destroy();
demogorgons.splice(d, 1);
continue;
}
// Remove if too far from game area
if (demo.x < -200 || demo.x > 2248 || demo.y < -200 || demo.y > 2932) {
demo.destroy();
demogorgons.splice(d, 1);
}
}
// Check battery pickup
for (var b = batteries.length - 1; b >= 0; b--) {
if (player.intersects(batteries[b])) {
player.addBattery(batteries[b].value);
LK.getSound('pickup').play();
batteries[b].destroy();
batteries.splice(b, 1);
}
}
// Check health kit pickup
for (var h = healthKits.length - 1; h >= 0; h--) {
if (player.intersects(healthKits[h])) {
player.heal(healthKits[h].value);
LK.getSound('pickup').play();
healthKits[h].destroy();
healthKits.splice(h, 1);
}
}
// Spawn items
itemSpawnTimer++;
if (itemSpawnTimer >= 300) {
// Every 5 seconds
if (Math.random() < 0.7) {
spawnBattery();
} else {
spawnHealthKit();
}
itemSpawnTimer = 0;
}
// Spawn demogorgons
demoSpawnTimer++;
var spawnRate = Math.max(300 - waveNumber * 30, 120); // Faster spawning each wave
if (demoSpawnTimer >= spawnRate) {
spawnDemogorgon();
demoSpawnTimer = 0;
}
// Wave progression
if (LK.ticks % 1800 === 0) {
// Every 30 seconds
waveNumber++;
// Increase demogorgon speed
for (var d = 0; d < demogorgons.length; d++) {
demogorgons[d].speed += 0.2;
}
}
// Update UI
healthText.setText('Health: ' + Math.floor(player.health));
batteryText.setText('Battery: ' + Math.floor(player.batteryLevel) + '%');
waveText.setText('Wave: ' + waveNumber);
// Game over condition
if (player.health <= 0) {
LK.setScore(waveNumber * 100 + LK.ticks);
LK.showGameOver();
}
// Keep player in bounds
player.x = Math.max(50, Math.min(1998, player.x));
player.y = Math.max(50, Math.min(2682, player.y));
};
// Start ambient music
LK.playMusic('ambient'); ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,325 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var Battery = Container.expand(function () {
+ var self = Container.call(this);
+ var batteryGraphics = self.attachAsset('battery', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.value = 25;
+ return self;
+});
+var Demogorgon = Container.expand(function () {
+ var self = Container.call(this);
+ var demoGraphics = self.attachAsset('demogorgon', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 1;
+ self.targetX = 0;
+ self.targetY = 0;
+ self.huntRadius = 400;
+ self.update = function () {
+ if (player && flashlight.alpha > 0.1) {
+ var dx = player.x - self.x;
+ var dy = player.y - self.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance < self.huntRadius) {
+ self.targetX = player.x;
+ self.targetY = player.y;
+ }
+ }
+ var moveX = self.targetX - self.x;
+ var moveY = self.targetY - self.y;
+ var moveDistance = Math.sqrt(moveX * moveX + moveY * moveY);
+ if (moveDistance > 5) {
+ self.x += moveX / moveDistance * self.speed;
+ self.y += moveY / moveDistance * self.speed;
+ }
+ };
+ return self;
+});
+var HealthKit = Container.expand(function () {
+ var self = Container.call(this);
+ var healthGraphics = self.attachAsset('healthKit', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.value = 30;
+ return self;
+});
+var HideSpot = Container.expand(function () {
+ var self = Container.call(this);
+ var hideGraphics = self.attachAsset('hideSpot', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ hideGraphics.alpha = 0.6;
+ 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.batteryLevel = 100;
+ self.isHiding = false;
+ self.maxBatteryLevel = 100;
+ self.takeDamage = function (amount) {
+ if (!self.isHiding) {
+ self.health -= amount;
+ if (self.health <= 0) {
+ self.health = 0;
+ }
+ }
+ };
+ self.heal = function (amount) {
+ self.health = Math.min(100, self.health + amount);
+ };
+ self.addBattery = function (amount) {
+ self.batteryLevel = Math.min(self.maxBatteryLevel, self.batteryLevel + amount);
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x0a0a0a
+});
+
+/****
+* Game Code
+****/
+var player = null;
+var flashlight = null;
+var demogorgons = [];
+var batteries = [];
+var healthKits = [];
+var hideSpots = [];
+var waveNumber = 1;
+var itemSpawnTimer = 0;
+var demoSpawnTimer = 0;
+var batteryDrainTimer = 0;
+var damageTimer = 0;
+// UI Elements
+var healthText = new Text2('Health: 100', {
+ size: 40,
+ fill: 0xFF0000
+});
+healthText.anchor.set(0, 0);
+healthText.x = 120;
+healthText.y = 20;
+LK.gui.topLeft.addChild(healthText);
+var batteryText = new Text2('Battery: 100%', {
+ size: 40,
+ fill: 0xFFFF00
+});
+batteryText.anchor.set(0, 0);
+batteryText.x = 120;
+batteryText.y = 70;
+LK.gui.topLeft.addChild(batteryText);
+var waveText = new Text2('Wave: 1', {
+ size: 50,
+ fill: 0xFFFFFF
+});
+waveText.anchor.set(0.5, 0);
+LK.gui.top.addChild(waveText);
+// Initialize player
+player = game.addChild(new Player());
+player.x = 1024;
+player.y = 1366;
+// Initialize flashlight
+flashlight = game.addChild(LK.getAsset('lightCircle', {
+ anchorX: 0.5,
+ anchorY: 0.5
+}));
+flashlight.alpha = 0.3;
+flashlight.x = player.x;
+flashlight.y = player.y;
+// Create initial hide spots
+function spawnHideSpots() {
+ for (var i = 0; i < 6; i++) {
+ var hideSpot = game.addChild(new HideSpot());
+ hideSpot.x = Math.random() * 1800 + 200;
+ hideSpot.y = Math.random() * 2400 + 200;
+ hideSpots.push(hideSpot);
+ }
+}
+function spawnBattery() {
+ var battery = game.addChild(new Battery());
+ battery.x = Math.random() * 1800 + 200;
+ battery.y = Math.random() * 2400 + 200;
+ batteries.push(battery);
+}
+function spawnHealthKit() {
+ var healthKit = game.addChild(new HealthKit());
+ healthKit.x = Math.random() * 1800 + 200;
+ healthKit.y = Math.random() * 2400 + 200;
+ healthKits.push(healthKit);
+}
+function spawnDemogorgon() {
+ var demo = game.addChild(new Demogorgon());
+ var edge = Math.floor(Math.random() * 4);
+ switch (edge) {
+ case 0:
+ // Top
+ demo.x = Math.random() * 2048;
+ demo.y = -100;
+ break;
+ case 1:
+ // Right
+ demo.x = 2148;
+ demo.y = Math.random() * 2732;
+ break;
+ case 2:
+ // Bottom
+ demo.x = Math.random() * 2048;
+ demo.y = 2832;
+ break;
+ case 3:
+ // Left
+ demo.x = -100;
+ demo.y = Math.random() * 2732;
+ break;
+ }
+ demo.targetX = demo.x;
+ demo.targetY = demo.y;
+ demogorgons.push(demo);
+}
+// Initialize starting items
+spawnHideSpots();
+spawnBattery();
+spawnBattery();
+spawnHealthKit();
+game.down = function (x, y, obj) {
+ tween(player, {
+ x: x,
+ y: y
+ }, {
+ duration: 500
+ });
+};
+game.update = function () {
+ // Update flashlight position
+ flashlight.x = player.x;
+ flashlight.y = player.y;
+ // Battery drain
+ batteryDrainTimer++;
+ if (batteryDrainTimer >= 60) {
+ // Every second
+ player.batteryLevel = Math.max(0, player.batteryLevel - 1);
+ batteryDrainTimer = 0;
+ }
+ // Adjust flashlight based on battery
+ if (player.batteryLevel <= 0) {
+ flashlight.alpha = 0;
+ // Player takes damage in darkness
+ damageTimer++;
+ if (damageTimer >= 120) {
+ // Every 2 seconds
+ player.takeDamage(10);
+ LK.getSound('damage').play();
+ damageTimer = 0;
+ }
+ } else {
+ flashlight.alpha = 0.3;
+ damageTimer = 0;
+ }
+ // Check if player is hiding
+ player.isHiding = false;
+ for (var h = 0; h < hideSpots.length; h++) {
+ if (player.intersects(hideSpots[h])) {
+ player.isHiding = true;
+ flashlight.alpha = Math.min(0.1, flashlight.alpha);
+ break;
+ }
+ }
+ // Update demogorgons
+ for (var d = demogorgons.length - 1; d >= 0; d--) {
+ var demo = demogorgons[d];
+ // Check collision with player
+ if (demo.intersects(player)) {
+ player.takeDamage(25);
+ LK.getSound('damage').play();
+ LK.effects.flashScreen(0xff0000, 300);
+ // Remove demogorgon after attack
+ demo.destroy();
+ demogorgons.splice(d, 1);
+ continue;
+ }
+ // Remove if too far from game area
+ if (demo.x < -200 || demo.x > 2248 || demo.y < -200 || demo.y > 2932) {
+ demo.destroy();
+ demogorgons.splice(d, 1);
+ }
+ }
+ // Check battery pickup
+ for (var b = batteries.length - 1; b >= 0; b--) {
+ if (player.intersects(batteries[b])) {
+ player.addBattery(batteries[b].value);
+ LK.getSound('pickup').play();
+ batteries[b].destroy();
+ batteries.splice(b, 1);
+ }
+ }
+ // Check health kit pickup
+ for (var h = healthKits.length - 1; h >= 0; h--) {
+ if (player.intersects(healthKits[h])) {
+ player.heal(healthKits[h].value);
+ LK.getSound('pickup').play();
+ healthKits[h].destroy();
+ healthKits.splice(h, 1);
+ }
+ }
+ // Spawn items
+ itemSpawnTimer++;
+ if (itemSpawnTimer >= 300) {
+ // Every 5 seconds
+ if (Math.random() < 0.7) {
+ spawnBattery();
+ } else {
+ spawnHealthKit();
+ }
+ itemSpawnTimer = 0;
+ }
+ // Spawn demogorgons
+ demoSpawnTimer++;
+ var spawnRate = Math.max(300 - waveNumber * 30, 120); // Faster spawning each wave
+ if (demoSpawnTimer >= spawnRate) {
+ spawnDemogorgon();
+ demoSpawnTimer = 0;
+ }
+ // Wave progression
+ if (LK.ticks % 1800 === 0) {
+ // Every 30 seconds
+ waveNumber++;
+ // Increase demogorgon speed
+ for (var d = 0; d < demogorgons.length; d++) {
+ demogorgons[d].speed += 0.2;
+ }
+ }
+ // Update UI
+ healthText.setText('Health: ' + Math.floor(player.health));
+ batteryText.setText('Battery: ' + Math.floor(player.batteryLevel) + '%');
+ waveText.setText('Wave: ' + waveNumber);
+ // Game over condition
+ if (player.health <= 0) {
+ LK.setScore(waveNumber * 100 + LK.ticks);
+ LK.showGameOver();
+ }
+ // Keep player in bounds
+ player.x = Math.max(50, Math.min(1998, player.x));
+ player.y = Math.max(50, Math.min(2682, player.y));
+};
+// Start ambient music
+LK.playMusic('ambient');
\ No newline at end of file
A Stranger Things demogorgon in pixel art. In-Game asset. 2d. High contrast. No shadows
Will Byers from Stranger Things in pixel art style. In-Game asset. 2d. High contrast. No shadows
Una pila en estilo pixel art. In-Game asset. 2d. High contrast. No shadows
Un arbusto en estilo pixel art. Que tenga tonos principalemente negros con tonos rojizos. In-Game asset. 2d. High contrast. No shadows
Un botiquín en estilo pixel art y sin fondo. In-Game asset. 2d. High contrast. No shadows