User prompt
Spawn 5 enemys from waves 1 to 2
User prompt
Make waves 1 to 4 spawn a random amount of fast enemys and regular enemys between 1-5
User prompt
Why are fast enemy’s spawning rather then the enemy
User prompt
Make the fast enemy speed 10
User prompt
Make a fast enemy asset
User prompt
The regular enemy’s are fast can you fix this?
User prompt
Fix Bug: 'Script error.' in or related to this line: 'var enemy = game.addChild(new Enemy());' Line Number: 138
User prompt
Fix Bug: 'Script error.' in or related to this line: 'var enemy = game.addChild(new Enemy());' Line Number: 138
User prompt
Make a fast enemy
User prompt
Fix Bug: 'ReferenceError: Can't find variable: stars' in or related to this line: 'for (var i = 0; i < stars.length; i++) {' Line Number: 202
User prompt
Fix Bug: 'ReferenceError: Can't find variable: stars' in or related to this line: 'for (var i = 0; i < stars.length; i++) {' Line Number: 202
User prompt
Make white stars that move in the background
User prompt
The background 1944 is not showing can you fix it?
User prompt
Make the background a background from the 1944
User prompt
Make 1 Boss Enemy and 2 enemys spawn on wave 9
User prompt
Don’t Let The Player Go Outside The Screen
User prompt
Make the boss enemy shoot every 0.45
User prompt
make the boss enemy die after 5 bullets hit it
User prompt
the boss enemy does not move can you fix it?
User prompt
get rid of the health bar
User prompt
Make the health bar not follow the player
User prompt
Fix Bug: 'Script error.' in or related to this line: 'var playerHealthBar = new PlayerHealthBar(hero.health);' Line Number: 189
User prompt
Make the player health bar follow the player
User prompt
Make a health bar for the player
User prompt
Get rid of the green block at the bottom of the screen
===================================================================
--- original.js
+++ change.js
@@ -1,7 +1,28 @@
/****
* Classes
****/
+var Enemy = Container.expand(function () {
+ var self = Container.call(this);
+ self.directionX = Math.random() < 0.5 ? -1 : 1;
+ self.directionY = Math.random() < 0.5 ? -1 : 1;
+ var enemyGraphics = self.attachAsset('enemy', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.health = 1;
+ self.speed = 5;
+ self.update = function () {
+ self.x += self.directionX * self.speed;
+ self.y += self.directionY * self.speed;
+ if (self.x <= 100 || self.x >= 1948) {
+ self.directionX *= -1;
+ }
+ if (self.y <= 100 || self.y >= 2732 / 2 - 100) {
+ self.directionY *= -1;
+ }
+ };
+});
// Define the Hero class
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = self.attachAsset('hero', {
@@ -134,9 +155,9 @@
}
} else {
// Other waves: Spawn regular enemies and one FastEnemy
for (var i = 0; i < self.enemiesPerWave - 1; i++) {
- var enemy = game.addChild(new FastEnemy());
+ var enemy = game.addChild(new Enemy());
enemy.x = Math.random() * (2048 - 100) + 50;
enemy.y = Math.random() * (2732 / 2 - 200) + 100;
self.enemies.push(enemy);
}