User prompt
Please fix the bug: 'TypeError: self.intersectRadius is not a function' in or related to this line: 'if (self.activated) {' Line Number: 609
Code edit (1 edits merged)
Please save this source code
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: midFrontContainer is not defined' in or related to this line: 'midFrontContainer.addChild(new ProjectileCross({' Line Number: 111
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
if a closest enemy was found, increase the baseAngle by the angle from the hero to the closestEnemy
User prompt
In the weaponCross class replace the TODO comment by finding the closest (square distance) child in the midgroundContainer, making sure that the child has tag TAG_ENEMY and not TAG_PROJECTILE
Code edit (2 edits merged)
Please save this source code
User prompt
Rename the midBackContainer to midgroundContainer
User prompt
Remove the midFrontContainer, replacing any occurrences with midBackContainer
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -173,8 +173,39 @@
}
// Enable inheritance
return self;
});
+var ProjectileEnemy = ConfigContainer.expand(function (config) {
+ var self = ConfigContainer.call(this, config);
+ var speedX = ENEMY_RANGED_SPEED_PROJECTILE * Math.cos(self.rotation);
+ var speedY = ENEMY_RANGED_SPEED_PROJECTILE * Math.sin(self.rotation);
+ var radiusSqr = ENEMY_RANGED_PROJECTILE_RADIUS * ENEMY_RANGED_PROJECTILE_RADIUS;
+ var projectileAsset = self.attachAsset('projectileEnemy', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ rotation: -MATH_QUARTER_PI
+ });
+ self.update = function () {
+ if (!isPaused) {
+ self.x += speedX;
+ self.y += speedY;
+ var dx = hero.x - self.x;
+ var dy = hero.y + heightDifference - self.y;
+ var distanceSqr = dx * dx + dy * dy;
+ if (LK.ticks % 15 === 0) {
+ projectileAsset.scale.x *= -1;
+ projectileAsset.scale.y *= -1;
+ projectileAsset.rotation += Math.PI;
+ }
+ if (distanceSqr <= radiusSqr) {
+ hero.takeDamage(damage);
+ self.callDestroy();
+ } else if (!checkBounds(self.x, self.y, ENEMY_BORDER_SPAWN)) {
+ self.callDestroy();
+ }
+ }
+ };
+});
var ProgressBar = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
var width = config.width || 120;
var height = config.height || 15;
@@ -643,9 +674,9 @@
LK.effects.flashObject(self.graphics, 0x000000, 500);
self.parent.addChild(new ProjectileEnemy({
x: graphics.x,
y: graphics.y,
- direction: Math.atan2(dy, dx),
+ rotation: Math.atan2(dy, dx),
damage: ENEMY_RANGED_ATTACK_DAMAGE
}));
};
self.onUpdate = function () {
@@ -904,9 +935,9 @@
var ENEMY_BASIC_ATTACK_RANGE = 100;
var ENEMY_BASIC_ATTACK_DAMAGE = 10;
var ENEMY_BASIC_ATTACK_COOLDOWN = GAME_TICKS / 6;
var ENEMY_BASIC_GRAPHICS_OFFSET = -100;
-var ENEMY_BASIC_BOB_MAGNITUDE = 2;
+var ENEMY_BASIC_BOB_MAGNITUDE = 20;
var ENEMY_BASIC_BOB_PERIOD = 10;
var ENEMY_BASIC_XP_DROP_CHANCE = 0.3; // Per level of Luck
var ENEMY_RANGED_SPEED = 1.5;
var ENEMY_RANGED_HEALTH_BASE = 20;
@@ -925,8 +956,10 @@
var ENEMY_RANGED_XP_DROP_CHANCE = 0.5; // Per level of Luck
var ENEMY_RANGED_DIFFICULTY = 0.2;
var ENEMY_RANGED_SPAWN_CHANCE_MIN = 0.4;
var ENEMY_RANGED_SPAWN_CHANCE_FACTOR = 0.5;
+var ENEMY_RANGED_PROJECTILE_SPEED = 10;
+var ENEMY_RANGED_PROJECTILE_RADIUS = 100;
// Pickup settings
var PICKUP_HEAL_MINOR = 0.1;
var PICKUP_HEAL_MAJOR = 1.0;
var PICKUP_HEALTH_COUNT = 3;
@@ -979,9 +1012,8 @@
countdown: 300
}));
;
// Game instances
-game.addChild(new EnemySpawner());
game.attachAsset('grassTop', {
y: HERO_BORDER - 100,
x: GAME_WIDTH / 2,
anchorX: 0.5
@@ -991,8 +1023,9 @@
x: GAME_WIDTH / 2,
anchorX: 0.5,
anchorY: 1.0
});
+var enemySpawner = game.addChild(new EnemySpawner());
var backgroundContainer = game.addChild(new Container());
var midBackContainer = game.addChild(new SortingContainer());
var hero = game.addChild(new Hero({
x: GAME_WIDTH / 2,
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