generated from sigonasr2/CPlusPlusProjectTemplate
parent
d457d88258
commit
1d45800bfd
Binary file not shown.
@ -0,0 +1,33 @@ |
|||||||
|
class Effect{ |
||||||
|
public: |
||||||
|
std::vector<Particle*> particles; |
||||||
|
virtual void create(std::vector<Particle*>&PARTICLES)=0; |
||||||
|
virtual bool update()=0; |
||||||
|
Effect(){} |
||||||
|
void render(PixelGameEngine*game) { |
||||||
|
for (int i=0;i<particles.size();i++) { |
||||||
|
particles[i]->render(game); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
class FountainEffect:public Effect{ |
||||||
|
int fountainDensity=0; |
||||||
|
int maxLifeTime=0; |
||||||
|
int lifetime=0; |
||||||
|
public: |
||||||
|
FountainEffect(int fountainDensity,int lifetime) |
||||||
|
:fountainDensity(fountainDensity),lifetime(lifetime),maxLifeTime(lifetime){} |
||||||
|
void create(std::vector<Particle*>&PARTICLES){ |
||||||
|
lifetime=maxLifeTime; |
||||||
|
for (int i=0;i<fountainDensity;i++) { |
||||||
|
PARTICLES.push_back(new WaterParticle({WIDTH/2,HEIGHT},{rand()%3+1,rand()%3+1},{0,rand()%10/10.0F+0.1F},lifetime,Pixel(rand()%128,rand()%128,255))); |
||||||
|
} |
||||||
|
} |
||||||
|
bool update()override{ |
||||||
|
lifetime--; |
||||||
|
return lifetime>0; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
FountainEffect*FOUNTAIN_EFFECT; |
Loading…
Reference in new issue