Code edit (21 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: e is undefined' in or related to this line: 'LK.effects.flashObject(self.collision, 0xAA0000, 1000);' Line Number: 508
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -27,18 +27,8 @@
self.onDestroy = function () {};
// Enable inheritance
return self;
});
-var WeaponFireball = ConfigContainer.expand(function (config) {
- var self = ConfigContainer.call(this, config);
- // Define properties and methods for WeaponFireball
- self.attachAsset('weaponFireball', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- // Additional properties and methods can be added here
- return self;
-});
var ProgressBar = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
var width = config.width || 120;
var height = config.height || 15;
@@ -62,8 +52,10 @@
};
if (config.percentage !== undefined) {
self.updatePercentage(config.percentage);
}
+ // Enable inheritance
+ return self;
});
var Pickup = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
self.activated = false;
@@ -79,15 +71,14 @@
}
}
};
self.onActivate = function () {};
+ // Enable inheritance
+ return self;
});
var PickupWeapon = Pickup.expand(function (config) {
var self = Pickup.call(this, config);
- var updateBase = function updateBase() {};
- if (self) {
- updateBase = self.update;
- }
+ var updateBase = self.update;
var scaleBase = self.scale;
self.pickupRange = PICKUP_WEAPON_RANGE;
var graphics = self.attachAsset(config.graphics, {
anchorX: 0.5,
@@ -105,8 +96,10 @@
startingWeapons[i].callDestroy();
}
callDestroy();
};
+ // Enable inheritance
+ return self;
});
var PickupHealing = Pickup.expand(function (config) {
var self = Pickup.call(this, config);
var updateBase = self.update;
@@ -121,65 +114,11 @@
};
self.onActivate = function () {
hero.healPercentage(PICKUP_HEAL_MINOR);
};
+ // Enable inheritance
+ return self;
});
-var PickupExperience = Pickup.expand(function (config) {
- var self = Pickup.call(this, config);
- var activeDist = 300;
- var activeDistSqr = activeDist * activeDist;
- var collectDistance = 80;
- var collectDistanceSqr = collectDistance * collectDistance;
- var combineDist = 150;
- var combineDistSqr = combineDist * combineDist;
- var experiencePickups = args.experiencePickups;
- self.experience = args.experience;
- experiencePickups.forEach(function (experiencePickup, node) {
- if (args.experiencePickup !== self) {
- var dx = experiencePickup.x - self.x;
- var dy = experiencePickup.y - self.y;
- var distanceSqr = dx * dx + dy * dy;
- if (distanceSqr <= combineDistSqr) {
- self.experience += experiencePickups.remove(node).experience;
- experiencePickup.callDestroy();
- self.x += dx / 2;
- self.y += dy / 2;
- }
- }
- });
- var size = 'Small';
- if (self.experience > 5) {
- size = 'Medium';
- if (self.experience > 10) {
- size = 'Large';
- }
- }
- var pickupGraphics = self.createAsset('pickupExperience' + size, {
- anchorX: 0.5,
- anchorY: 0.5
- });
- var active = false;
- var speed = 20;
- self.update = function (args) {
- var hero = args.hero;
- var dx = hero.x - self.x;
- var dy = hero.y - self.y;
- var distanceSqr = dx * dx + dy * dy;
- if (distanceSqr <= activeDistSqr) {
- self.active = true;
- if (distanceSqr <= collectDistanceSqr) {
- addExperience(self.experience);
- return true;
- }
- }
- if (self.active) {
- var distance = Math.sqrt(distanceSqr);
- self.x += dx / distance * speed;
- self.y += dy / distance * speed;
- }
- };
- self.onActivate = function () {};
-});
var PickupCrucifix = Pickup.expand(function (config) {
var self = Pickup.call(this, config);
self.pickupRange = PICKUP_CRUCIFIX_RANGE;
self.attachAsset('pickupCrucifix', {
@@ -506,16 +445,16 @@
}));
startingWeapons.push(backgroundContainer.addChild(new PickupWeapon({
x: GAME_WIDTH / 4 * 2,
y: GAME_HEIGHT / 8 * 3,
- graphics: 'weaponFireball',
- weaponClass: WeaponFireball
+ graphics: 'weaponFireball'
+ // weaponClass: WeaponFireball
})));
startingWeapons.push(backgroundContainer.addChild(new PickupWeapon({
x: GAME_WIDTH / 4 * 2,
y: GAME_HEIGHT / 8 * 5,
- graphics: 'weaponCross',
- weaponClass: WeaponCross
+ graphics: 'weaponCross'
+ // weaponClass: WeaponCross
})));
;
//==============================================================================
// Global events
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