Code edit (7 edits merged)
Please save this source code
User prompt
Add a RangedEnemy class which moves towards the hero, periodically shooting EnemyProjectiles towards the hero when it's within 500 range
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: midgroundContainer is not defined' in this line: 'var enemy = new BasicEnemy(midgroundContainer, x, y, {' Line Number: 95
User prompt
make an EnemySpawner class that handles the spawning of enemies instead of the tick event
Code edit (1 edits merged)
Please save this source code
User prompt
countdown timer should continue counting down even after reaching zero
User prompt
when the countdowntimer reaches zero, perform a once-off update that changes the text to red
Code edit (8 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: bool is not defined' in this line: 'if (bool === 'Health') {' Line Number: 862
Code edit (5 edits merged)
Please save this source code
User prompt
healing pickups first check if the hero is at max health already before applying the heal and destroying itself
User prompt
Fix Bug: 'ReferenceError: health is not defined' in this line: 'if (health <= 0) {' Line Number: 684
User prompt
change the hero's `var health` and `var healthMax` to `self.health` and `self.healthMax` and update any references to these variables found within the hero class
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: sqrt is not defined' in this line: 'var distance = sqrt(distance);' Line Number: 317
Code edit (6 edits merged)
Please save this source code
User prompt
Here's a list of things to do: 1) set enemy health bar offset from 50 to -50. 2) Increase enemy attack range from 100. 3) Add a setFill function to the BorderText, which sets the fill of the last element of textList. 4) Reduce healingpickup limit from 5 to 3.
Code edit (2 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: weapons is undefined' in this line: 'weapons.push(new CrossWeapon(self));' Line Number: 700
Code edit (1 edits merged)
Please save this source code
User prompt
Create a DoubleLinkedList class with Node class for linked list elements
Code edit (4 edits merged)
Please save this source code
User prompt
add a function that creates a generic linkedlist
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -158,8 +158,10 @@
ticker = 60;
countdown--;
if (countdown >= 0) {
adjustLabel();
+ } else if (countdown === 0) {
+ countdownTxt.setFill('#ff0000');
}
}
return 1 - countdown / initialCountdown;
}
@@ -219,9 +221,9 @@
selectedBoons.push(availableBoons.splice(boonIndex, 1)[0]);
}
}
if (selectedBoons.length < 3) {
- selectedBoons.push('Full Heal');
+ selectedBoons.push(type === 'Minor' ? 'Minor Heal' : 'Full Heal');
}
var background = self.createAsset('boonBackground', 'Boon Selection Popup', 0.5, 0.5);
var boonMessageTitle = new BorderedText('Choose ' + count, {
y: -220,
@@ -279,9 +281,9 @@
var activeDist = 300;
var activeDistSqr = activeDist * activeDist;
var collectDistance = 80;
var collectDistanceSqr = collectDistance * collectDistance;
- var combineDist = 100;
+ var combineDist = 150;
var combineDistSqr = combineDist * combineDist;
var experiencePickups = args.experiencePickups;
self.experience = args.experience;
experiencePickups.forEach(function (experiencePickup, node) {
@@ -418,10 +420,9 @@
kill(args);
return true;
}
var hero = args.hero;
- var game = args.game;
- var backgroundContainer = args.backgroundContainer;
+ var midgroundContainer = args.midgroundContainer;
var foregroundContainer = args.foregroundContainer;
var dx = hero.x - self.x;
var dy = hero.y + heightDifference - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
@@ -437,9 +438,9 @@
}
}
var newParent;
if (self.y <= hero.y + heightDifference) {
- newParent = backgroundContainer;
+ newParent = midgroundContainer;
} else {
newParent = foregroundContainer;
}
if (parent !== newParent) {
@@ -448,19 +449,19 @@
}
}
function kill(args) {
var hero = args.hero;
- var game = args.game;
var effects = args.effects;
var healthPickups = args.healthPickups;
var crucifixPickups = args.crucifixPickups;
var experiencePickups = args.experiencePickups;
+ var backgroundContainer = args.backgroundContainer;
if (crucifixPickups.length < 1 && Math.random() < Math.sqrt(hero.minorBoonLevels['Luck']) / 100) {
- crucifixPickups.push(new CrucifixPickup(game, self.x, self.y));
+ crucifixPickups.push(new CrucifixPickup(backgroundContainer, self.x, self.y));
} else if (healthPickups.length < 3) {
for (var k = 0; k <= 1 + hero.minorBoonLevels['Luck']; k++) {
if (Math.random() < 0.02) {
- healthPickups.push(new HealingPickup(game, self.x, self.y));
+ healthPickups.push(new HealingPickup(backgroundContainer, self.x, self.y));
break;
}
}
}
@@ -472,14 +473,14 @@
}
if (droppedExperience > 0) {
var x = self.x + Math.random() * 100 - 50;
var y = self.y + Math.random() * 100 - 50;
- experiencePickups.push(new ExperiencePickup(game, x, y, {
+ experiencePickups.push(new ExperiencePickup(backgroundContainer, x, y, {
experience: droppedExperience,
experiencePickups
}));
}
- effects.push(new BasicBloodSplatter(game, self.x, self.y));
+ effects.push(new BasicBloodSplatter(parent, self.x, self.y));
}
function onTakeDamage(takenDamage) {
health -= takenDamage;
if (health > 0) {
@@ -508,9 +509,9 @@
var growth = 1;
var growthRate = args.growthRate;
var initialScale = args.scale;
var currentScale = initialScale;
- var scaleDamageFactor = 0.25;
+ var scaleDamageFactor = 0.1;
var range = args.range;
var damage = args.damage;
var linger = args.linger;
var angle = args.angle;
@@ -548,11 +549,11 @@
}
range -= Math.abs(speed);
var tick = LK.ticks;
enemies.forEach(function (enemy) {
- if (enemy.collision.intersects(self)) {
- var lastHitTick = hitMap[enemy.id];
- if (!lastHitTick || tick - lastHitTick > 10) {
+ var lastHitTick = hitMap[enemy.id];
+ if (!lastHitTick || tick - lastHitTick > 10) {
+ if (enemy.collision.intersects(self)) {
hitMap[enemy.id] = tick;
enemy.onTakeDamage(damage * (1 + (currentScale - 1) * scaleDamageFactor));
}
}
@@ -586,9 +587,9 @@
var scale = 1 + 0.35 * hero.minorBoonLevels['Scale'];
var range = 200 + 100 * hero.minorBoonLevels['Range'];
var damage = 15 + 10 * hero.minorBoonLevels['Damage'];
var linger = 0 + 15 * hero.minorBoonLevels['Duration'];
- var growthRate = 0.25 * hero.majorBoonLevels['Growth'] / 60;
+ var growthRate = 0.15 * hero.majorBoonLevels['Growth'] / 60;
var spreadCount = 1 + hero.majorBoonLevels['Split'];
var dx = hero.shootPos.x - hero.x;
var dy = hero.shootPos.y - hero.y;
var baseAngle = Math.atan2(dy, dx) - spreadCount * spreadIncrement / 2;
@@ -631,10 +632,10 @@
'Duration': 0,
'Health': 0
};
self.majorBoonLevels = {
- 'Growth': 3,
- 'Split': 3
+ 'Growth': 0,
+ 'Split': 0
};
self.shootPos = {
x,
y
@@ -714,9 +715,8 @@
y: 0
},
size: 80
});
- var selectingBoon = false;
var progressBarBorder = LK.getAsset('progressBarBorder', 'Progress Bar Border', 0, .5);
var progressBar = LK.getAsset('progressBar', 'Progress Bar', 0, .5);
var enemyIdCounter = -1;
var heroProjectiles = new LinkedList();
@@ -790,9 +790,8 @@
hero
});
updateIteration(enemyProjectiles);
updateIteration(enemies, {
- game: self,
backgroundContainer,
midgroundContainer,
foregroundContainer,
experiencePickups,
@@ -819,43 +818,41 @@
}
}
});
function showBoonSelection() {
- if (!selectingBoon) {
- var boonSelection;
- if (minorBoonCount) {
- selectingBoon = true;
- boonSelection = new BoonSelection(hero.minorBoonLevels, 'Minor', minorBoonCount, function (boon) {
- minorBoonCount--;
- if (!checkBoonActions(boon)) {
- hero.minorBoonLevels[boon]++;
- upgradeButton.setCount(minorBoonCount + majorBoonCount);
- selectingBoon = false;
- showBoonSelection();
- }
- });
- } else if (majorBoonCount) {
- selectingBoon = true;
- boonSelection = new BoonSelection(hero.majorBoonLevels, 'Major', majorBoonCount, function (boon) {
- majorBoonCount--;
- if (!checkBoonActions(boon)) {
- hero.majorBoonLevels[boon]++;
- upgradeButton.setCount(minorBoonCount + majorBoonCount);
- selectingBoon = false;
- showBoonSelection();
- }
- });
- }
- if (boonSelection) {
- isPaused = true;
- LK.gui.center.addChild(boonSelection);
- } else {
- isPaused = false;
- }
- upgradeButton.setHidden(selectingBoon);
+ var boonSelection;
+ if (minorBoonCount) {
+ boonSelection = new BoonSelection(hero.minorBoonLevels, 'Minor', minorBoonCount, function (boon) {
+ minorBoonCount--;
+ if (!checkBoonActions(boon)) {
+ hero.minorBoonLevels[boon]++;
+ upgradeButton.setCount(minorBoonCount + majorBoonCount);
+ }
+ showBoonSelection();
+ });
+ } else if (majorBoonCount) {
+ boonSelection = new BoonSelection(hero.majorBoonLevels, 'Major', majorBoonCount, function (boon) {
+ majorBoonCount--;
+ if (!checkBoonActions(boon)) {
+ hero.majorBoonLevels[boon]++;
+ upgradeButton.setCount(minorBoonCount + majorBoonCount);
+ }
+ showBoonSelection();
+ });
}
+ if (boonSelection) {
+ isPaused = true;
+ LK.gui.center.addChild(boonSelection);
+ } else {
+ isPaused = false;
+ }
+ upgradeButton.setHidden(isPaused);
}
function checkBoonActions(boon) {
+ if (boon === 'Minor Heal') {
+ hero.onHealPercentage(0.1);
+ return true;
+ }
if (boon === 'Full Heal') {
hero.onHealPercentage(1);
return true;
}
@@ -886,9 +883,9 @@
x = 0;
y = 2732 * distance;
break;
}
- enemies.push(new BasicEnemy(self, x, y, {
+ enemies.push(new BasicEnemy(midgroundContainer, x, y, {
id: (++enemyIdCounter).toString(),
difficultyScale
}));
}
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