Code edit (2 edits merged)
Please save this source code
User prompt
add a HealthBar to the BasicEnemy class only if it's been hit
User prompt
Create a new `HealthBar` class based on the hero's health bar
User prompt
create a new HealthBar class based on the heroes healthbar, without changing the hero itself
Code edit (4 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: enemy is not defined' in this line: 'LK.effects.flashObject(enemy, 0xaa0000, 1000);' Line Number: 197
Code edit (1 edits merged)
Please save this source code
User prompt
enemies briefly flash white when hit
Code edit (1 edits merged)
Please save this source code
User prompt
projectiles should record in a map which enemies it hit (by the enemy id) and the last tick they were hit. Enemies cannot get hit more than once every 10 ticks
Code edit (11 edits merged)
Please save this source code
User prompt
instead of generating a unique id, use an integer which is incremented
User prompt
Fix Bug: 'TypeError: LK.generateUniqueId is not a function' in this line: 'enemies.push(new BasicEnemy(self, x, y, {' Line Number: 704
User prompt
Fix Bug: 'TypeError: LK.generateUniqueId is not a function' in this line: 'enemies.push(new BasicEnemy(self, x, y, {' Line Number: 704
User prompt
add a unique id to enemies, passed through in the constructor args object
Code edit (6 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: t.setStageReference is not a function' in this line: 'parent.addChild(self);' Line Number: 138
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
in the CrossWeapon's launch function, create additional projectiles based on the hero's "Extra" major boon. These additional projectiles should have their angle uniformally distributed in a radius around the hero
Code edit (3 edits merged)
Please save this source code
User prompt
make the screen flash red when a basicenemy deals damage to the hero
Code edit (4 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: updateButton is not defined' in this line: 'updateButton.visible = bool;' Line Number: 595
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -96,9 +96,9 @@
var hero = vars.hero;
var dx = hero.x - self.x;
var dy = hero.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
- if (distance < 400) {
+ if (distance < 250) {
self.active = true;
if (self.intersects(hero)) {
hero.addExperience(experience);
return true;
@@ -191,9 +191,9 @@
cooldown -= 1;
if (cooldown <= 0) {
cooldown = initialCooldown;
hero.health -= damage;
- LK.effects.flashScreen(0xff0000, 500);
+ LK.effects.flashScreen(0xff0000, 200);
}
}
var newParent;
if (self.y <= hero.y) {
@@ -241,28 +241,51 @@
parent.addChild(self);
self.x = x;
self.y = y;
var projectileAsset = self.createAsset('crossProjectile', 'Projectile Asset', .5, .5);
- var speed = 30;
+ var initialSpeed = 30;
+ var speed = initialSpeed;
+ var speedDecrement = 1;
+ var destroyRange = -1200;
+ var growth = 1;
+ var growthRate = args.growthRate;
+ var initialScale = args.scale;
var range = args.range;
var damage = args.damage;
- var destroyRange = -1200;
+ var linger = args.linger;
var angle = args.angle;
self.scale = {
- x: args.scale,
- y: args.scale
+ x: initialScale,
+ y: initialScale
};
self.update = update;
function update(args) {
var hero = args.hero;
var enemies = args.enemies;
self.x += speed * Math.cos(angle);
self.y += speed * Math.sin(angle);
self.rotation += 0.2;
- range -= Math.abs(speed);
- if (range <= 0 && speed > -30) {
- speed -= 1;
+ if (growthRate > 0) {
+ growth += growthRate;
+ var newScale = initialScale * growth;
+ self.scale = {
+ x: newScale,
+ y: newScale
+ };
}
+ if (range <= 0) {
+ if (speed > -initialSpeed) {
+ if (speed <= 0 && linger > 0) {
+ speed = 0;
+ linger--;
+ } else {
+ speed -= speedDecrement;
+ }
+ } else {
+ speed = -initialSpeed;
+ }
+ }
+ range -= Math.abs(speed);
for (var i = 0; i < enemies.length; i++) {
var enemy = enemies[i];
if (self.intersects(enemy)) {
enemy.health -= damage;
@@ -295,20 +318,24 @@
var projectiles = args.projectiles;
var dx = hero.shootPos.x - hero.x;
var dy = hero.shootPos.y - hero.y;
var angle = Math.atan2(dy, dx);
+ var growthRate = 0.01 * hero.majorBoonLevels['Growth'] / 60;
var scale = 1 + 0.25 * hero.minorBoonLevels['Scale'];
var range = 200 + 50 * hero.minorBoonLevels['Range'];
var damage = 10 + 5 * hero.minorBoonLevels['Damage'];
- var extraProjectiles = hero.majorBoonLevels['Extra'];
- var angleIncrement = extraProjectiles > 0 ? Math.PI * 2 / extraProjectiles : 0;
- for (var i = 0; i <= extraProjectiles; i++) {
+ var linger = 0 + 10 * hero.minorBoonLevels['Linger'];
+ var projectileCount = 1 + hero.majorBoonLevels['Extra'];
+ var angleIncrement = Math.PI * 2 / projectileCount;
+ for (var i = 0; i <= projectileCount; i++) {
var currentAngle = angle + i * angleIncrement;
projectiles.push(new CrossProjectile(game, hero.x, hero.y, {
+ angle: currentAngle,
+ growthRate,
scale,
range,
damage,
- angle: currentAngle
+ linger
}));
}
}
});
@@ -319,28 +346,32 @@
self.y = y;
var heroGraphics = self.createAsset('hero', 'Hero character', .5, .5);
var progressBar = args.progressBar;
var onLevelUp = args.onLevelUp;
+ var baseMaxHealth = 100;
var experience = 0;
var level = 1;
var levelRequirement = 20;
self.minorBoonLevels = {
'Luck': 0,
'Scale': 0,
'Range': 0,
'Damage': 0,
- 'Rearm': 0
+ 'Rearm': 0,
+ 'Linger': 0,
+ 'Health': 0
};
self.majorBoonLevels = {
- 'Split': 0,
- 'Extra': 1
+ 'Growth': 0,
+ 'Spread': 0,
+ 'Extra': 0
};
self.shootPos = {
x,
y
};
- self.healthMax = 100;
- self.health = self.healthMax;
+ self.healthMax = baseMaxHealth;
+ self.health = baseMaxHealth;
self.healthBarBorder = self.createAsset('healthBarBorder', 'Health Bar Border', 0.5, 1);
self.healthBarBorder.y = -115;
self.healthBar = self.createAsset('healthBar', 'Health Bar', 0.5, 1);
self.healthBar.y = -120;
@@ -350,8 +381,12 @@
self.update = update;
self.addExperience = addExperience;
function update(args) {
var game = args.game;
+ var newMaxHealth = baseMaxHealth + 20 * self.minorBoonLevels['Health'];
+ if (self.healthMax < newMaxHealth) {
+ self.maxHealth = newMaxHealth;
+ }
self.healthBar.scale.x = Math.max(0, self.health / self.healthMax);
if (self.health <= 0) {
LK.showGameOver();
}
@@ -590,15 +625,15 @@
LK.effects.flashScreen(0xffffff, 1000);
break;
}
}
- if (LK.ticks % (60 - Math.floor(55 * difficultyScale)) === 0) {
+ if (LK.ticks % (60 - Math.floor(50 * difficultyScale)) === 0) {
spawnEnemy();
}
}
});
function refreshBoonUpgradeButton() {
- var bool = minorBoonCount + majorBoonCount > 0;
+ var bool = !selectingBoon && minorBoonCount + majorBoonCount > 0;
upgradeButton.visible = bool;
availableBoonsTxt.visible = bool;
availableBoonsTxt.setText(minorBoonCount + majorBoonCount);
}
@@ -633,8 +668,9 @@
LK.gui.center.addChild(boonSelection);
} else {
isPaused = false;
}
+ refreshBoonUpgradeButton();
}
}
function spawnEnemy() {
var side = Math.floor(Math.random() * 4);
pixel art cross with blue accents Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a white orb. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a white orb with a halo. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a pulsating white heart with a halo. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a dark goo projectile with red highlights. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art tall blue fireball. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of an evil fantasy sword facing downward. Minor red details. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
backgroundAmbient
Sound effect
heroHealed
Sound effect
pickupExperience
Sound effect
heroLeveled
Sound effect
weaponCrossImpact
Sound effect
heroImpact
Sound effect
enemyDeath
Sound effect
pickupWeapon
Sound effect
pickupCrucifix
Sound effect
weaponCrossLaunch
Sound effect
heroDeath
Sound effect
enemyRoar
Sound effect
clockChime
Sound effect