User prompt
Move the zombie to zombie intersection code to game class
User prompt
If two zombies touch each other, merge them together into a larger zombie
User prompt
Remove bullets that fly off screen
User prompt
On bullets don’t set a target, just set a direction
User prompt
When attaching a bullet, attach it with a z-index lower than the hero
User prompt
Remove the code that attaches bullets in fire, the in game, attach the bullet there instead
User prompt
Only allow the hero to fire bullets if the hero is standing still
User prompt
When shooting a bullet rotate the hero to the direction of fire
User prompt
Rotate bullets by 90deg clockwise in the bullet move method
User prompt
Make bullets rotate in the direction of travel
User prompt
Only allow a bullet to hit a enemy once
User prompt
If zombie.hit returns true, the zombie is dead. Remove it from the game and zombies array then
User prompt
In the bullet and zombie intersect method loop bullets and zombies separately
User prompt
On zombie hit, return true if the zombie health is less than zero
User prompt
On zombie hit, return if the zombie health is less than zero
User prompt
Use i— when splicing from the bullets array
User prompt
Limit how quickly the hero can shoot
User prompt
In game when calling shoot in game, make sure the shoot method returns the new bullet. Then in game, add the returned bullet to the bullets array
User prompt
In game when calling shoot, add the returned bullet to the bullets areay
User prompt
When calling hero shoot, return the bullet and add it to the bullets array
User prompt
Bullets does not seem to move
User prompt
In game make the hero shoot bullets towards the nearest zombie
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'self.gameInstance.bullets.push')' in this line: 'self.gameInstance.bullets.push(bullet);' Line Number: 66
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'self.gameInstance.bullets.push')' in this line: 'self.gameInstance.bullets.push(bullet);' Line Number: 66
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'this.gameInstance.bullets')' in this line: 'this.gameInstance.bullets.push(bullet);' Line Number: 65
===================================================================
--- original.js
+++ change.js
@@ -50,15 +50,20 @@
self.y = self.targetY;
}
}
};
+ self.shootDelay = 0;
self.shoot = function (zombies) {
- var nearestZombie = self.findNearestZombie(zombies);
- if (nearestZombie) {
- var bullet = new Bullet(self, nearestZombie);
- self.parent.addChild(bullet);
- return bullet;
+ if (self.shootDelay <= 0) {
+ var nearestZombie = self.findNearestZombie(zombies);
+ if (nearestZombie) {
+ var bullet = new Bullet(self, nearestZombie);
+ self.parent.addChild(bullet);
+ self.shootDelay = 30;
+ return bullet;
+ }
}
+ self.shootDelay--;
return null;
};
});
var Zombie = Container.expand(function (hero) {
@@ -141,12 +146,15 @@
scoreTxt.anchor.set(.5, 0);
LK.gui.topCenter.addChild(scoreTxt);
LK.on('tick', function () {
hero.move();
- var newBullet = hero.shoot(zombies);
- if (newBullet) {
- bullets.push(newBullet);
+ if (hero.shootDelay <= 0) {
+ var newBullet = hero.shoot(zombies);
+ if (newBullet) {
+ bullets.push(newBullet);
+ }
}
+ hero.shootDelay--;
for (var i = 0; i < zombies.length; i++) {
zombies[i].move();
}
for (var i = 0; i < bullets.length; i++) {
Soldier with gun seen from above. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
empty abandoned city street background seen from the top. Zoomed in. Top down. Street only
Zombie seen from above. Arms in front of it Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Fired Bullet tip, no case, grayscale Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Simple circular click target, showing where the hero needs to walk to. Grayscale. No shadows Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cloud puff explosion, grayscale, seen from topdown. Circular. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.