Fixed bug with dead players being zombies (not visible but playing). Added option to change color at the beginning of level 1. Explosion animation now has player's color and takes place for all of them when they are killed (before only for last one). Final explosion animation and gameover now start where last player was killed.

This commit is contained in:
Phew
2026-03-15 22:35:00 +01:00
parent 9bf87677a4
commit a8c6a01422
3 changed files with 104 additions and 41 deletions

View File

@@ -4,24 +4,29 @@
class Particle
{
public:
void Spawn(int pos);
void Spawn(int pos, int life, int aging_speed, const int color[3]);
void Tick(int USE_GRAVITY);
void Kill();
bool Alive();
int _pos;
int _power;
int _color[3];
private:
int _life;
int _alive;
int _sp;
int _aging;
};
void Particle::Spawn(int pos){
void Particle::Spawn(int pos, int life, int aging_speed, const int color[3]){
_pos = pos;
_sp = random(-200, 200);
_sp = random(-life, life);
_power = 255;
_alive = 1;
_life = 220 - abs(_sp);
_life = life - abs(_sp);
_aging = aging_speed;
for (int i = 0; i< 3; i++) _color[i] = color[i];
}
void Particle::Tick(int USE_GRAVITY){
@@ -33,7 +38,7 @@ void Particle::Tick(int USE_GRAVITY){
_sp += _life/10;
}
if(USE_GRAVITY && _pos > 500) _sp -= 10;
_power = 100 - _life;
_power = 100 - _aging*_life;
if(_power <= 0){
Kill();
}else{