Commit 2d44930c authored by a.guest's avatar a.guest

Update processing.pde

parent 4890f982
...@@ -206,7 +206,9 @@ class ExplosionPart ...@@ -206,7 +206,9 @@ class ExplosionPart
float y_position; float y_position;
float x_velocity; float x_velocity;
float y_velocity; float y_velocity;
int colour; int red_colour;
int green_colour;
int blue_colour;
int part_size; int part_size;
ExplosionPart(float x, float y) ExplosionPart(float x, float y)
...@@ -219,7 +221,9 @@ class ExplosionPart ...@@ -219,7 +221,9 @@ class ExplosionPart
y_velocity = random(20)-10; y_velocity = random(20)-10;
// give the part a random shade of red as a starting colour // give the part a random shade of red as a starting colour
// each update the part will get slightly darker // each update the part will get slightly darker
colour = int(random(200))+50; red_colour = int(random(200))+50;
green_colour = 0;
blue_colour = 0;
// give the part a random size // give the part a random size
// each update the part will get slightly smaller // each update the part will get slightly smaller
part_size=15 +int(random(10)); part_size=15 +int(random(10));
...@@ -228,11 +232,24 @@ class ExplosionPart ...@@ -228,11 +232,24 @@ class ExplosionPart
void update() void update()
{ {
// make the part's colour a little darker // make the part's colour a little darker
colour = colour - int(random(20)); red_colour = red_colour - int(random(20));
if (colour<10) if (red_colour<0)
{ {
colour = 10; red_colour = 0;
} }
green_colour = green_colour - int(random(20));
if (green_colour<0)
{
green_colour = 0;
}
blue_colour = blue_colour - int(random(20));
if (blue_colour<0)
{
blue_colour = 0;
}
// make the part a little smaller // make the part a little smaller
part_size--; part_size--;
if (part_size<1) if (part_size<1)
...@@ -248,7 +265,7 @@ class ExplosionPart ...@@ -248,7 +265,7 @@ class ExplosionPart
void render() void render()
{ {
fill(colour,0,0); fill(red_colour,green_colour,blue_colour);
ellipse(x_position,y_position,part_size,part_size); ellipse(x_position,y_position,part_size,part_size);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment