User prompt
make the lasers a little bit smaller
User prompt
make bombs explosion area smaller and when the bomb exploded it is still can kill us fix this problems
User prompt
when a bomb spawns make it doesnt kill the player after 1.6 seconds
User prompt
after the bomb exploded its killing area is still active make it dissapear after the bomb exploded and when we avoided from 20 attacks lasers are 3x faster make it 2x
User prompt
i want the bomb to be image like our character
User prompt
when we avoided from 10 attacks make a new attack type it creates a random bomb into the cube room and it will explode after 1.5 second the explotions area will be same as the bombs area and when it explodes another one will be spawn and if the player touches it while it exploiding player will die ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
make warnings visible before the laser
User prompt
when we avoided from 20 attacks make lasers spawn time 1.5x slower and make a warning about where the next laser will come from
User prompt
make the lasers 3x faster when we avoided from 20 attacks
User prompt
make skeletons health 300
User prompt
make skeletons health 30
User prompt
make lasers acceleration faster and when we avoid from each attack skeleton should get damage
User prompt
make lasers slower from start and they will slowly be faster but it will stay in the same speed when it is 4 times faster from start ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
make the room smaller and make lasers smaller too
User prompt
make us in a cube room and we cant get out
User prompt
ok now when we get hit from his attacks make it kill us
User prompt
rewrite the source code
User prompt
Heart Escape: Skeleton Showdown
Initial prompt
make me a game we will be a heart that is our main character and our enemy is a skeleton with a jacket and he will tryna kill us with his skills utils like one of them is a lasers coming to us and we need to escape from them and everytime when we escape from his utils the enemy will get damage a little bit and when we escape enough of his utils he will die and we will win
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var HealthBar = Container.expand(function () {
var self = Container.call(this);
var background = self.attachAsset('healthBarBg', {
anchorX: 0,
anchorY: 0
});
var foreground = self.attachAsset('healthBarFg', {
anchorX: 0,
anchorY: 0
});
self.setHealth = function (percent) {
foreground.scale.x = Math.max(0, Math.min(1, percent));
};
return self;
});
var Heart = Container.expand(function () {
var self = Container.call(this);
var heartGraphic = self.attachAsset('heart', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 3;
self.invulnerable = false;
self.lastX = 0;
self.lastY = 0;
self.down = function (x, y, obj) {
self.dragging = true;
};
self.up = function (x, y, obj) {
self.dragging = false;
};
self.takeDamage = function () {
if (self.invulnerable) return;
// Set health to 0 directly to kill player immediately
self.health = 0;
LK.getSound('hit').play();
// Flash red when taking damage
LK.effects.flashObject(self, 0xff0000, 500);
// No need for invulnerability since player dies immediately
LK.getSound('gameOver').play();
LK.showGameOver();
};
self.update = function () {
self.lastX = self.x;
self.lastY = self.y;
};
return self;
});
var Laser = Container.expand(function () {
var self = Container.call(this);
var laserGraphic = self.attachAsset('laser', {
anchorX: 0.5,
anchorY: 0.5
});
self.active = true;
self.direction = 1; // 1: vertical, 2: diagonal left, 3: diagonal right
self.speed = 15;
self.lastY = 0;
self.lastIntersecting = false;
self.setup = function (direction, speed) {
self.direction = direction || 1;
self.speed = speed || 15;
if (self.direction === 1) {
// Vertical laser
laserGraphic.rotation = 0;
} else if (self.direction === 2) {
// Diagonal left
laserGraphic.rotation = Math.PI / 4;
} else if (self.direction === 3) {
// Diagonal right
laserGraphic.rotation = -Math.PI / 4;
}
};
self.update = function () {
self.lastY = self.y;
if (self.direction === 1) {
self.y += self.speed;
} else if (self.direction === 2) {
self.y += self.speed;
self.x -= self.speed * 0.8;
} else if (self.direction === 3) {
self.y += self.speed;
self.x += self.speed * 0.8;
}
};
return self;
});
var PlayerHealthDisplay = Container.expand(function () {
var self = Container.call(this);
var heartsContainer = new Container();
self.addChild(heartsContainer);
self.updateHealth = function (health) {
heartsContainer.removeChildren();
for (var i = 0; i < health; i++) {
var heartIcon = LK.getAsset('heart', {
anchorX: 0.5,
anchorY: 0.5,
scale: 0.3
});
heartIcon.x = i * 70;
heartsContainer.addChild(heartIcon);
}
};
return self;
});
var Skeleton = Container.expand(function () {
var self = Container.call(this);
// Create skeleton body
var skeletonGraphic = self.attachAsset('skeleton', {
anchorX: 0.5,
anchorY: 0.5
});
// Add jacket on top
var jacketGraphic = self.attachAsset('jacket', {
anchorX: 0.5,
anchorY: 0.5,
y: -20
});
self.maxHealth = 100;
self.health = self.maxHealth;
self.attackCooldown = 0;
self.attackPattern = 1;
self.lastAttackTime = 0;
self.takeDamage = function (amount) {
self.health -= amount;
// Flash red when taking damage
LK.effects.flashObject(self, 0xff0000, 300);
if (self.health <= 0) {
LK.getSound('victory').play();
LK.showYouWin();
}
// Increase difficulty as health decreases
if (self.health < self.maxHealth * 0.7 && self.attackPattern === 1) {
self.attackPattern = 2; // More frequent attacks
} else if (self.health < self.maxHealth * 0.4 && self.attackPattern === 2) {
self.attackPattern = 3; // Even more frequent and complex attacks
}
};
self.update = function () {
self.attackCooldown--;
// Subtle movement
self.x += Math.sin(LK.ticks / 20) * 2;
};
// Create attack based on current pattern
self.createAttack = function () {
if (self.attackCooldown > 0) return null;
var attack;
var now = Date.now();
// Ensure minimum time between attacks
if (now - self.lastAttackTime < 800) return null;
self.lastAttackTime = now;
// Different attack patterns based on skeleton's health
if (self.attackPattern === 1) {
// Basic pattern: vertical lasers
self.attackCooldown = 60;
attack = {
type: 'laser',
direction: 1,
speed: 15,
position: {
x: 1024 + Math.random() * 1000 - 500
}
};
} else if (self.attackPattern === 2) {
// Medium pattern: vertical and diagonal lasers
self.attackCooldown = 45;
var dir = Math.floor(Math.random() * 3) + 1;
attack = {
type: 'laser',
direction: dir,
speed: 18,
position: {
x: 1024 + Math.random() * 1200 - 600
}
};
} else {
// Hard pattern: faster and more varied attacks
self.attackCooldown = 30;
var dir = Math.floor(Math.random() * 3) + 1;
attack = {
type: 'laser',
direction: dir,
speed: 22,
position: {
x: 1024 + Math.random() * 1400 - 700
}
};
}
return attack;
};
return self;
});
/****
* Initialize Game
****/
// Game variables
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Game variables
var heart;
var skeleton;
var healthBar;
var playerHealth;
var lasers = [];
var score = 0;
var dragging = false;
// Set background color
game.setBackgroundColor(0x000033);
// Create player heart
heart = game.addChild(new Heart());
heart.x = 1024;
heart.y = 2000;
// Create skeleton enemy
skeleton = game.addChild(new Skeleton());
skeleton.x = 1024;
skeleton.y = 400;
// Create health bar for skeleton
healthBar = game.addChild(new HealthBar());
healthBar.x = (2048 - 800) / 2;
healthBar.y = 200;
// Create player health display
playerHealth = game.addChild(new PlayerHealthDisplay());
playerHealth.x = 150;
playerHealth.y = 2600;
playerHealth.updateHealth(heart.health);
// Score text
var scoreTxt = new Text2('Attacks Avoided: 0', {
size: 70,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
scoreTxt.x = 1024;
scoreTxt.y = 100;
game.addChild(scoreTxt);
// Instructions text
var instructionsTxt = new Text2('Drag the heart to avoid attacks!', {
size: 50,
fill: 0xFFFFFF
});
instructionsTxt.anchor.set(0.5, 0);
instructionsTxt.x = 1024;
instructionsTxt.y = 2500;
game.addChild(instructionsTxt);
// Game movement handlers
game.move = function (x, y, obj) {
if (dragging) {
heart.x = x;
heart.y = y;
// Keep heart within screen bounds
heart.x = Math.max(100, Math.min(heart.x, 2048 - 100));
heart.y = Math.max(800, Math.min(heart.y, 2732 - 100));
}
};
game.down = function (x, y, obj) {
dragging = true;
};
game.up = function (x, y, obj) {
dragging = false;
};
// Main game update loop
game.update = function () {
// Update heart
heart.update();
// Update skeleton and create new attacks
skeleton.update();
var attack = skeleton.createAttack();
if (attack && attack.type === 'laser') {
var laser = new Laser();
laser.x = attack.position.x;
laser.y = skeleton.y + 200;
laser.setup(attack.direction, attack.speed);
laser.lastY = laser.y;
laser.lastIntersecting = laser.intersects(heart);
lasers.push(laser);
game.addChild(laser);
}
// Update lasers
for (var i = lasers.length - 1; i >= 0; i--) {
var laser = lasers[i];
laser.update();
// Check for collisions with heart
var currentIntersecting = laser.intersects(heart);
if (!laser.lastIntersecting && currentIntersecting) {
// Heart was hit by laser
heart.takeDamage();
playerHealth.updateHealth(heart.health);
}
// Remove lasers that go off screen
if (laser.lastY < 2800 && laser.y > 2800 || laser.x < -200 || laser.x > 2248) {
// If we successfully avoided the laser, damage the skeleton
if (!currentIntersecting && laser.active) {
score++;
scoreTxt.setText('Attacks Avoided: ' + score);
skeleton.takeDamage(5);
healthBar.setHealth(skeleton.health / skeleton.maxHealth);
laser.active = false; // Mark as processed
LK.getSound('avoid').play();
}
// Remove laser
laser.destroy();
lasers.splice(i, 1);
}
laser.lastIntersecting = currentIntersecting;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -38,23 +38,16 @@
self.dragging = false;
};
self.takeDamage = function () {
if (self.invulnerable) return;
- self.health--;
+ // Set health to 0 directly to kill player immediately
+ self.health = 0;
LK.getSound('hit').play();
// Flash red when taking damage
LK.effects.flashObject(self, 0xff0000, 500);
- // Make invulnerable for a short period
- self.invulnerable = true;
- self.alpha = 0.5;
- LK.setTimeout(function () {
- self.invulnerable = false;
- self.alpha = 1;
- }, 1500);
- if (self.health <= 0) {
- LK.getSound('gameOver').play();
- LK.showGameOver();
- }
+ // No need for invulnerability since player dies immediately
+ LK.getSound('gameOver').play();
+ LK.showGameOver();
};
self.update = function () {
self.lastX = self.x;
self.lastY = self.y;