Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: heightDifference is not defined' in or related to this line: 'var dy = hero.y + heightDifference - self.y;' Line Number: 97
Code edit (16 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: self is undefined' in or related to this line: 'var updateBase = self.update;' Line Number: 117
User prompt
Please fix the bug: 'ReferenceError: WeaponFireball is not defined' in or related to this line: 'startingWeapons.push(backgroundContainer.addChild(new PickupWeapon({' Line Number: 525
Code edit (2 edits merged)
Please save this source code
User prompt
add a hero asset with anchor (0.5, 1.0) to the Hero class
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: tint is not defined' in or related to this line: 'var bar = self.attachAsset('shapeBox', {' Line Number: 73
Code edit (7 edits merged)
Please save this source code
User prompt
add an outlineSmall asset to the joystickKnob and an outlineLarge asset to the joystick
Code edit (2 edits merged)
Please save this source code
User prompt
add a new sorting container (inheriting from Container) that has an update function that sorts it's children array by their ascending y value
Code edit (3 edits merged)
Please save this source code
User prompt
Replace all usages of the 'blank' asset with the 'shapeBox' asset
User prompt
Migrate to the latest version of LK
Code edit (1 edits merged)
Please save this source code
Code edit (9 edits merged)
Please save this source code
User prompt
flash the CrossWeapon's aimArrow and the FireballWeapon's projectileLaunchers white during the launch function
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: tryUpdateLaunchers is not defined' in this line: 'tryUpdateLaunchers(args);' Line Number: 1024
Code edit (14 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: existingEffect.refresh is not a function' in this line: 'existingEffect.refresh({' Line Number: 803
Code edit (5 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -50,10 +50,9 @@
};
function updateIteration(list, args) {
list.forEach(function (item, node) {
if (item.update(args)) {
- item.destroy();
- list.remove(node);
+ list.remove(node).destroy();
}
});
}
function checkBounds(x, y, borderOrBorderX = 0, borderY) {
@@ -462,14 +461,12 @@
var distanceSqr = dx * dx + dy * dy;
var state;
if (checkBounds(self.x, self.y, borderMin)) {
state = 'move';
+ } else if (distanceSqr < scaredRangeSqr) {
+ state = checkBounds(self.x, self.y, borderX, borderY) ? 'cornered' : 'flee';
} else {
- if (distanceSqr < scaredRangeSqr) {
- state = checkBounds(self.x, self.y, borderX, borderY) ? 'cornered' : 'flee';
- } else {
- state = distanceSqr <= attackRangeSqr ? 'attack' : 'move';
- }
+ state = distanceSqr <= attackRangeSqr ? 'attack' : 'move';
}
var canAttack = false;
var speedFactor = 0;
switch (state) {
@@ -582,9 +579,9 @@
self.x += dx / distance * speed;
self.y += dy / distance * speed + Math.sin((LK.ticks - creationTick) / bobPeriod) * bobMagnitude;
cooldown = initialCooldown;
} else {
- cooldown -= 1;
+ cooldown--;
if (cooldown <= 0) {
cooldown = initialCooldown;
hero.onTakeDamage(damage);
}
@@ -602,15 +599,13 @@
var experiencePickups = args.experiencePickups;
var backgroundContainer = args.backgroundContainer;
if (crucifixPickups.length < 1 && Math.random() < Math.sqrt(hero.minorBoonLevels['Luck']) / 100) {
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(backgroundContainer, self.x, self.y));
- break;
- }
+ } else if (healthPickups.length < 3) {
+ for (var k = 0; k <= 1 + hero.minorBoonLevels['Luck']; k++) {
+ if (Math.random() < 0.02) {
+ healthPickups.push(new HealingPickup(backgroundContainer, self.x, self.y));
+ break;
}
}
}
var droppedExperience = 0;
@@ -696,33 +691,40 @@
});
var BurningEffect = Container.expand(function (parent, x, y, args) {
var self = Container.call(this);
parent.addChild(self);
+ parent.burningEffect = self;
+ self.refresh = refresh;
+ self.update = update;
self.x = x;
self.y = y;
- var burningGraphics = self.createAsset('burningGraphics', 'Burning Graphics', .5, .5);
+ self.createAsset('burningGraphics', 'Burning Graphics', .5, .65);
var interval = args.interval;
var duration = args.duration;
var damagePerInterval = args.damagePerSecond * interval / 60;
var lifetime = 0;
- var damage = damagePerSecond;
var baseAlpha = 0.5;
- self.update = update;
function update() {
- if (parent.health >= 0) {
+ if (parent.health <= 0) {
+ parent.burningEffect = undefined;
return true;
}
lifetime++;
var flair = lifetime % interval;
if (flair === 0) {
- parent.onDealDamage(damage);
+ parent.onTakeDamage(damagePerInterval);
}
if (lifetime >= duration) {
+ parent.burningEffect = undefined;
return true;
}
- self.alpha = baseAlpha + flair / interval * (1 - baseAlpha);
+ self.alpha = (baseAlpha + flair / interval * (1 - baseAlpha)) * baseAlpha;
}
- ;
+ function refresh(args) {
+ lifetime = 0;
+ damagePerInterval = args.damagePerSecond * interval / 60;
+ duration = args.duration;
+ }
});
var FireballExplosion = Container.expand(function (parent, x, y, args) {
var self = Container.call(this);
parent.addChild(self);
@@ -731,9 +733,9 @@
var explosionGraphics = self.createAsset('fireballExplosion', 'Fireball Explosion', .5, .5);
var initialScale = args.scale;
var scale = initialScale;
var maxScale = initialScale + 1;
- var scaleRate = 0.05;
+ var scaleRate = 0.075;
self.update = update;
self.rotation = args.rotation;
function update() {
scale += scaleRate;
@@ -753,9 +755,9 @@
self.y = y;
var projectileAsset = self.createAsset('fireballProjectile', 'Fireball Projectile', .5, .5);
var hitMap = {};
var speed = 15;
- var baseRadius = 100;
+ var baseRadius = 200;
var burnInterval = 15;
var pierce = args.pierce;
var direction = args.direction;
var duration = args.duration;
@@ -795,13 +797,21 @@
var dy = nearbyEnemy.y - self.y;
var distanceSqr = dx * dx + dy * dy;
if (distanceSqr <= radiusSqr) {
hitMap[nearbyEnemy.id] = true;
- effects.push(new BurningEffect(nearbyEnemy, 0, 0, {
- damagePerSecond,
- duration,
- burnInterval
- }));
+ var existingEffect = nearbyEnemy.burningEffect;
+ if (existingEffect) {
+ existingEffect.refresh({
+ damagePerSecond,
+ duration
+ });
+ } else {
+ effects.push(new BurningEffect(nearbyEnemy, 0, 0, {
+ interval: burnInterval,
+ damagePerSecond,
+ duration
+ }));
+ }
}
}
});
effects.push(new FireballExplosion(args.game, self.x, self.y, {
@@ -830,12 +840,10 @@
var rotationTicks = 0;
var rotationOffset = -10;
var rotationSpeed = Math.PI / 120;
var projectileOffset = 150;
- weaponGraphics.scale = {
- x: 1.25,
- y: 1.25
- };
+ weaponGraphics.scale.x = 1.25;
+ weaponGraphics.scale.y = 1.25;
self.active = false;
self.update = update;
function update(args) {
var hero = args.hero;
@@ -848,12 +856,10 @@
if (rotationTicks % cooldown === 0) {
launch(args);
cooldown = initialCooldown - 20 * hero.minorBoonLevels['Rearm'];
}
- } else {
- if (hero.collision.intersects(collisionPoint)) {
- activate(args);
- }
+ } else if (hero.collision.intersects(collisionPoint)) {
+ activate(args);
}
}
function activate(args) {
var hero = args.hero;
@@ -863,23 +869,25 @@
self.y = hero.y;
tryUpdateLaunchers(args);
weaponGraphics.destroy();
collisionPoint.destroy();
- weapons.forEach(function (weapon) {
- if (weapon.active) {}
+ weapons.forEach(function (weapon, node) {
+ if (!weapon.active) {
+ weapons.remove(node).destroy();
+ }
});
}
function launch(args) {
var projectiles = args.projectiles;
var hero = args.hero;
var game = args.game;
var scale = 1 + 0.35 * hero.minorBoonLevels['Scale'];
- var pierce = 1 + 1 * hero.minorBoonLevels['Range'];
- var damage = 25 + 15 * hero.minorBoonLevels['Damage'];
- var duration = 0 + 15 * hero.minorBoonLevels['Duration'];
+ var pierce = 2 + 1 * hero.minorBoonLevels['Range'];
+ var damage = 20 + 15 * hero.minorBoonLevels['Damage'];
+ var duration = 60 + 45 * hero.minorBoonLevels['Duration'];
var growthRate = 0.15 * hero.majorBoonLevels['Growth'] / 60;
var angle = 2 * Math.PI / projectileLaunchers.length;
- var angleOffset = rotationTicks % (2 * cooldown) === 0 ? angle / 2 : 0;
+ var angleOffset = rotationTicks % (2 * cooldown) === 0 ? 0 : angle / 2;
for (let i = 0; i < projectileLaunchers.length; i++) {
var direction = angleOffset + angle * i - Math.PI / 2;
var projectileX = hero.x + Math.cos(direction) * projectileOffset;
var projectileY = hero.y + Math.sin(direction) * projectileOffset;
@@ -1179,13 +1187,9 @@
if (canMove) {
hero.targetPos = obj.event.getLocalPosition(self);
}
hero.shootPos = obj.event.getLocalPosition(self);
- if (hero.shootPos.x < hero.x) {
- hero.scale.x = -1;
- } else {
- hero.scale.x = 1;
- }
+ hero.scale.x = hero.shootPos.x < hero.x ? -1 : 1;
}
});
LK.on('tick', function () {
if (!isPaused) {
@@ -1252,19 +1256,17 @@
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();
- });
- }
+ } 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);
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