User prompt
fix the above problem
User prompt
the RGB value for 100% health should be 60, 179, 113 for 1% health it should be 255, 0, 0
User prompt
Dynamically change the colour of the player character based on % of total health left. 100% is bright green, 1% is bright red, interpolate the color
User prompt
reduce player health by 10 every time the player collides with an enemy, the player can be damaged a maximum of four times per second
User prompt
make the health bar narrower and longer
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'self.parent.healthBar.updateHealth')' in this line: 'self.parent.healthBar.updateHealth(self.health);' Line Number: 56
User prompt
show player health in a bar in the top left of the screen
User prompt
add health to the player character. It starts with the value 100
User prompt
change the spawn enemy function. it should check every 250ms and spawn only one enemy at a time
User prompt
increase maximum number of enemies on screen to 50
User prompt
increase maximum number of enemies on screen to 30
User prompt
create a maximum number of enemies on screen = 10
User prompt
increase the maximum rate of fire of the player gun to once every 1 tick
User prompt
Halve the speed of bullets
User prompt
halve speed of bullets
User prompt
change the limitation on how many bullets can exist at any one time to 2
User prompt
double speed of bullets
Initial prompt
Copy Nightmare in the Amoeba Zone
===================================================================
--- original.js
+++ change.js
@@ -43,8 +43,13 @@
};
});
var Hero = Container.expand(function () {
var self = Container.call(this);
+ Hero.prototype.getHealthColor = function () {
+ var green = Math.floor(this.health / 100 * 255);
+ var red = 255 - green;
+ return red << 16 | green << 8;
+ };
self.health = 100;
var heroGraphics = self.createAsset('hero', 'Hero character', .5, .5);
self.bullets = [];
self.move = function () {
@@ -58,8 +63,9 @@
if (currentTime - self.lastDamageTime >= 15) {
self.health -= amount;
if (self.health < 0) self.health = 0;
self.healthBar.updateHealth(self.health);
+ heroGraphics.tint = self.getHealthColor();
self.lastDamageTime = currentTime;
}
};
self.shoot = function () {
amoeba Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Green equilateral triangle, fills the entire picture space in width and height Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
square box viewed from above. White with a large Red Cross Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Purple bomb Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
space image stylised gas clouds, black and white image, low contrast