User prompt
Create a new enemy every 2 seconds
User prompt
Remove the code that creates the enemy after the first minion is created
User prompt
When a minion is destroyed, remove it from the minions array
User prompt
When the enemy is destroyed remove it from the enemies array
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'self.parent.addChild(deadBody);' Line Number: 40
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'deadBodies')' in this line: 'self.parent.deadBodies.push(deadBody);' Line Number: 37
User prompt
When the enemy's health is 0, destroy it and create a dead body in it's place
User prompt
The damage done by the player to the enemy is 0.7
User prompt
The enemy's health cannot go below 0
User prompt
If the player is near the enemy, do damage to the enemy
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'enemies')' in this line: 'for (var i = 0; i < self.parent.enemies.length; i++) {' Line Number: 201
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'enemies')' in this line: 'for (var i = 0; i < self.parent.enemies.length; i++) {' Line Number: 201
User prompt
When the minion's health is 0, destroy the minion
User prompt
Change the damage done to the enemy to 0.7
User prompt
Place the health bar of the enemy at 30 on the Y axis
User prompt
Place the health bar of the enemy at -50 on the X axis
User prompt
Change the enemy health bar height to 20 pixels
User prompt
Have the enemy render the health bar in front of the shadow and the main sprite
User prompt
Add a healthbar to the enemy
User prompt
When the minion is being attacked, it doesn't move
User prompt
When the minion is attacking the enemy, do not move the enemy
User prompt
Change the damage done to the minion by the enemy to be 1
User prompt
Change the damage done to the minion by the enemy to be 3
User prompt
Place the health bar of the minion at -50 on the X axis
User prompt
Place the health bar of the minion at 30 on the Y axis
var timeNeededNearDeadBody = 1;
var Enemy = Container.expand(function () {
var self = Container.call(this);
self.healthBar = new MeterBar();
self.addChild(self.healthBar);
self.healthBar.y = -30;
self.updateHealthBar = function () {
self.healthBar.scale.x = self.health / 100;
};
self.updateHealthBar();
self.health = 100;
var shadowGraphics = self.createAsset('shadow', 'Shadow Graphics', .5, .5);
shadowGraphics.scale.x = 2;
shadowGraphics.scale.y = 0.66;
var enemyGraphics = self.createAsset('enemy', 'Enemy Graphics', .5, 1);
self.speed = 5;
self.movedDistance = 0;
self.pauseTicks = 0;
self.isPaused = false;
self.move = function (player) {
var dx = player.x - self.x;
var dy = player.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance <= 150) {
self.health -= 10;
player.health -= 10;
self.updateHealthBar();
if (player instanceof Minion) {
player.updateHealthBar();
}
} else if (distance > 60 && !self.isPaused) {
var moveX = dx / distance * self.speed;
var moveY = dy / distance * self.speed;
self.x += moveX;
self.y += moveY;
if (moveX < 0) {
enemyGraphics.scale.x = -1;
} else {
enemyGraphics.scale.x = 1;
}
self.movedDistance += Math.sqrt(moveX * moveX + moveY * moveY);
if (self.movedDistance >= 300) {
self.isPaused = true;
self.movedDistance = 0;
}
} else if (self.isPaused) {
self.pauseTicks++;
if (self.pauseTicks >= 45) {
self.isPaused = false;
self.pauseTicks = 0;
}
}
};
});
var MinionCreationVFX = Container.expand(function () {
var self = Container.call(this);
var minionCreationVFXGraphics = self.createAsset('minionCreationVFX', 'Minion Creation VFX', .5, 1);
self.scale.x = 0;
self.scale.y = 0;
self.ticksToScale = 15;
self.currentScaleTick = 0;
self.scaleVFX = function () {
if (self.currentScaleTick < self.ticksToScale) {
var scaleAmount = 1 / self.ticksToScale;
self.scale.x += scaleAmount;
self.scale.y += scaleAmount;
self.currentScaleTick++;
} else if (self.currentScaleTick === self.ticksToScale) {
self.destroy();
}
};
});
var MeterBar = Container.expand(function () {
var self = Container.call(this);
var meterBarBackgroundGraphics = self.createAsset('meterBarBackground', 'MeterBar Background Image', 0, 0.5);
var meterBarGraphics = self.createAsset('meterBar', 'MeterBar Graphics', 0, 0.5);
});
var DeadBody = Container.expand(function () {
var self = Container.call(this);
var deadBodyGraphics = self.createAsset('deadBody', 'Dead Body Graphics', .5, 1);
});
var Player = Container.expand(function () {
var self = Container.call(this);
var shadowGraphics = self.createAsset('shadow', 'Shadow Graphics', .5, .5);
shadowGraphics.scale.x = 2;
shadowGraphics.scale.y = 0.66;
var playerGraphics = self.createAsset('player', 'Player Graphics', .5, 1);
self.meterBar = new MeterBar();
self.meterBar.scale.y = 0.2;
self.targetPosition = null;
self.speed = 8;
self.move = function (deadBodies, enemies) {
if (self.targetPosition) {
var dx = self.targetPosition.x - self.x;
var dy = self.targetPosition.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < self.speed) {
self.x = self.targetPosition.x;
self.y = Math.min(self.targetPosition.y, 2732);
self.targetPosition = null;
if (dx < 0) {
playerGraphics.scale.x = -1;
} else {
playerGraphics.scale.x = 1;
}
} else {
self.x += dx / distance * self.speed;
self.y = Math.max(Math.min(self.y + dy / distance * self.speed, 2732), 1200);
if (dx < 0) {
playerGraphics.scale.x = -1;
} else {
playerGraphics.scale.x = 1;
}
}
}
for (var i = 0; i < deadBodies.length; i++) {
var deadBody = deadBodies[i];
var distanceToDeadBody = Math.sqrt(Math.pow(self.x - deadBody.x, 2) + Math.pow(self.y - deadBody.y, 2));
if (distanceToDeadBody < 200) {
if (!self.meterBar.parent) {
self.addChild(self.meterBar);
self.meterBar.y = -430;
self.meterBar.x = -100;
self.meterBar.scale.x = 0;
self.timeSpentNearDeadBody = 0;
self.startTick = null;
}
if (!self.startTick && !self.targetPosition) {
self.startTick = LK.ticks;
}
if (!self.targetPosition) {
self.timeSpentNearDeadBody += 1 / 60;
self.meterBar.scale.x = Math.min(2, self.timeSpentNearDeadBody / timeNeededNearDeadBody);
if (self.meterBar.scale.x >= 2) {
var newMinion = new Minion();
newMinion.x = deadBody.x;
newMinion.y = deadBody.y;
self.parent.minions.push(newMinion);
self.parent.addChild(newMinion);
self.removeChild(self.meterBar);
self.timeSpentNearDeadBody = 0;
self.meterBar.scale.x = 0;
deadBody.destroy();
var minionCreationVFX = new MinionCreationVFX();
minionCreationVFX.x = newMinion.x;
minionCreationVFX.y = newMinion.y;
self.parent.addChild(minionCreationVFX);
if (self.parent.minions.length === 1) {
var newEnemy = new Enemy();
if (Math.random() < 0.5) {
newEnemy.x = Math.random() * 2048;
newEnemy.y = 2732;
} else {
newEnemy.x = Math.random() < 0.5 ? 0 : 2048;
newEnemy.y = Math.random() * (2732 - 1200) + 1200;
}
enemies.push(newEnemy);
self.parent.addChild(newEnemy);
}
}
}
} else if (self.meterBar.parent) {
self.meterBar.parent.removeChild(self.meterBar);
self.timeSpentNearDeadBody = 0;
}
}
};
});
var Minion = Container.expand(function () {
var self = Container.call(this);
var shadowGraphics = self.createAsset('shadow', 'Shadow Graphics', .5, .5);
shadowGraphics.scale.x = 2;
shadowGraphics.scale.y = 0.66;
var minionGraphics = self.createAsset('minion', 'Minion Graphics', .5, 1);
self.healthBar = new MeterBar();
self.addChild(self.healthBar);
self.healthBar.y = 30;
self.healthBar.scale.y = 20 / self.healthBar.height;
self.updateHealthBar = function () {
self.healthBar.scale.x = self.health / 100;
};
self.updateHealthBar();
self.health = 100;
self.speed = 5;
self.scale.x = 0;
self.scale.y = 0;
self.ticksToScale = 15;
self.currentScaleTick = 0;
self.move = function (player) {
self.updateHealthBar();
self.updateHealthBar();
var target = player;
var minDistance = 500;
for (var i = 0; i < self.parent.enemies.length; i++) {
var enemy = self.parent.enemies[i];
var dx = enemy.x - self.x;
var dy = enemy.y - self.y;
var distanceToEnemy = Math.sqrt(dx * dx + dy * dy);
if (distanceToEnemy < minDistance) {
minDistance = distanceToEnemy;
target = enemy;
}
}
if (target === player && minDistance >= 500) {
target = player;
}
if (target) {
var dx = target.x - self.x;
var dy = target.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
}
if (distance <= 150 && target instanceof Enemy) {
self.health = Math.max(self.health - 10, 0);
target.health = Math.max(target.health - 10, 0);
self.updateHealthBar();
target.updateHealthBar();
} else if (distance > 60) {
self.x += dx / distance * self.speed;
if (dx > 0) {
minionGraphics.scale.x = -1;
} else {
minionGraphics.scale.x = 1;
}
self.y += dy / distance * self.speed;
}
};
self.attack = function () {};
self.scaleMinion = function () {
if (self.currentScaleTick < self.ticksToScale) {
var scaleAmount = 1 / self.ticksToScale;
self.scale.x += scaleAmount;
self.scale.y += scaleAmount;
self.currentScaleTick++;
}
};
});
var HeroBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.createAsset('heroBullet', 'Hero Bullet Graphics', .5, .5);
self.speed = 10;
self.move = function () {};
});
var EnemyBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.createAsset('enemyBullet', 'Enemy Bullet Graphics', .5, .5);
self.speed = -10;
self.move = function () {};
});
var Background = Container.expand(function () {
var bgSelf = Container.call(this);
var backgroundGraphics = bgSelf.createAsset('background', 'Background Image', 0, 0);
bgSelf.addChild(backgroundGraphics);
});
var Game = Container.expand(function () {
var self = Container.call(this);
var background = self.addChild(new Background());
background.x = LK.stage.width / 2 - background.width / 2;
background.y = LK.stage.height - background.height;
var player = self.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 - 200;
self.deadBodies = [];
var deadBody = new DeadBody();
deadBody.x = 2048 / 2;
deadBody.y = 1750;
self.deadBodies.push(deadBody);
self.addChild(deadBody);
self.minions = [];
self.enemies = [];
var heroBullets = [];
var enemyBullets = [];
LK.on('tick', function () {
player.move(self.deadBodies, self.enemies);
self.children.sort(function (a, b) {
return a.y - b.y;
});
self.deadBodies = self.deadBodies.filter(function (deadBody) {
return deadBody.parent;
});
for (var i = 0; i < self.minions.length; i++) {
self.minions[i].scaleMinion();
self.minions[i].move(player);
}
for (var i = 0; i < self.enemies.length; i++) {
self.enemies[i].move(player);
}
for (var i = 0; i < self.children.length; i++) {
if (self.children[i] instanceof MinionCreationVFX) {
self.children[i].scaleVFX();
}
}
});
LK.stage.on('down', function (obj) {
var pos = obj.event.getLocalPosition(self);
player.targetPosition = pos;
});
});
A pixel art sprite in a Super Nintendo, Super Castlevania style where it looks a little gothic/vampire hunter like Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A pixel art large background in a Super Nintendo, Super Castlevania style with an open world like cemetery, 3/4 viewpoint Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. A pixel art sprite in a Super Nintendo, Super Castlevania style that looks like a small pile of bones
Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. A pixel art sprite in a Super Nintendo, Super Castlevania style that looks like a skeleton zombie that is haunched over
Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. Pixel art in a SNES style that looks like something from castlevania. A ground explosion effect like something is coming out of the ground
Pixel art in SNES Castlevania style. Red goblin Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. Pixel art in SNES Castlevania style. Red goblin