User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'game.bullets')' in this line: 'game.bullets.push(bullet);' Line Number: 65
User prompt
Fix Bug: 'ReferenceError: Can't find variable: bullets' in this line: 'bullets.push(bullet);' Line Number: 65
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'self')' in this line: 'self.findNearestZombie = function (zombies) {' Line Number: 15
User prompt
Make the hero auto shoot in the direction of the nearest zombie
User prompt
Also add 90deg counter clockwise to zombie asset when updating rotation in move
User prompt
Add 90 degrees counter clockwise to the zombie asser
User prompt
Make the zombie asset rotate in the direction of movement
User prompt
Add health bars to zombies
User prompt
Move background to the left by 80 px
User prompt
Move background to the left by 100 px
User prompt
Make zombies spawn outside the screen in a random direction and walk towards the hero at a fixed speed
User prompt
Set background alpha to .2
User prompt
Add a background element to the center of the game
User prompt
Move up health bar in hero by 75px
User prompt
Move up foreground element in health bar by 5px
User prompt
Move up background element in health bar by 5px
User prompt
Set health bar anchors to .5,1
User prompt
Set hero graphic anchor point to .4,.3
User prompt
Set hero graphic anchor point to .4,.3
User prompt
Set hero graphic anchor point to .3,.4
User prompt
Set hero graphic anchor point to .3,.2
User prompt
Set hero graphic anchor point to .2,.3
User prompt
Set hero graphic anchor point to .2,.2
User prompt
Set hero graphic anchor point to .2,.4
User prompt
Set hero graphic anchor point to .2,.3
===================================================================
--- original.js
+++ change.js
@@ -61,15 +61,16 @@
var dx = nearestZombie.x - self.x;
var dy = nearestZombie.y - self.y;
var angle = Math.atan2(dy, dx);
var bullet = new Bullet(self.x, self.y, angle);
- game.bullets.push(bullet);
+ this.gameInstance.bullets.push(bullet);
self.addChild(bullet);
}
};
});
var Zombie = Container.expand(function (hero) {
var self = Container.call(this);
+ self.gameInstance = arguments[0];
var zombieGraphics = self.createAsset('zombie', 'Zombie character', .5, .5);
zombieGraphics.rotation = -Math.PI / 2;
self.target = hero;
self.healthBar = self.addChild(new HealthBar(100, 100));
@@ -131,9 +132,9 @@
background.y = 2732 / 2;
background.alpha = .2;
var hero, zombies = [], bullets = [];
var scoreTxt, timer;
- hero = self.addChild(new Hero());
+ hero = self.addChild(new Hero(self));
hero.x = 2048 / 2;
hero.y = 2732 / 2;
scoreTxt = new Text2('0', {
size: 150,
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.