generated from sigonasr2/CPlusPlusProjectTemplate
parent
ca4134fbb9
commit
d457d88258
Binary file not shown.
@ -0,0 +1,10 @@ |
||||
|
||||
#define WIDTH 256 |
||||
#define HEIGHT 224 |
||||
#define TILEMAP_SIZE_X 512 |
||||
#define TILEMAP_SIZE_Y 512 |
||||
#define TILEMAP_EDITOR_DRAW_MULT 0.4375 |
||||
#define TILEMAP_EDITOR_TILESIZE (32*TILEMAP_EDITOR_DRAW_MULT) |
||||
#define PARTY_TRAIL_LENGTH 48 |
||||
#define CAMERA_WAIT_TIME 60 |
||||
#define HEALTH_ROLLING_SPEED 2 |
@ -0,0 +1,53 @@ |
||||
class Particle{ |
||||
public: |
||||
vd2d pos; |
||||
vd2d spd; |
||||
vd2d acc; |
||||
int lifetime; //In frames.
|
||||
bool wrap; |
||||
Particle(vd2d pos,vd2d spd,vd2d acc,int lifetime,bool wrap=false) |
||||
:pos(pos),spd(spd),acc(acc),lifetime(lifetime){}; |
||||
virtual void render(PixelGameEngine*game)=0; |
||||
virtual void particleUpdate()=0; |
||||
void update() { |
||||
spd+=acc; |
||||
pos+=spd; |
||||
if (wrap) { |
||||
if (pos.x<0) { |
||||
pos.x+=WIDTH;
|
||||
} else |
||||
if (pos.y<0) { |
||||
pos.y+=HEIGHT;
|
||||
} |
||||
if (pos.x>WIDTH) { |
||||
pos.x-=WIDTH;
|
||||
} else
|
||||
if (pos.y>HEIGHT) { |
||||
pos.y-=HEIGHT; |
||||
} |
||||
} |
||||
} |
||||
vd2d GetPos() { |
||||
return pos; |
||||
} |
||||
vd2d GetSpd() { |
||||
return spd; |
||||
} |
||||
vd2d GetAcc() { |
||||
return acc; |
||||
} |
||||
void SetPos(vd2d pos) { |
||||
this->pos=pos; |
||||
} |
||||
}; |
||||
|
||||
class LineParticle:public Particle{ |
||||
public: |
||||
Pixel col; |
||||
LineParticle(vd2d pos,vd2d spd,vd2d acc,int lifetime,Pixel col=WHITE,bool wrap=false) |
||||
:col(col),Particle(pos,spd,acc,lifetime,wrap){} |
||||
void particleUpdate()override{} |
||||
void render(PixelGameEngine*game)override{ |
||||
game->DrawLineDecal(pos,pos+spd,col); |
||||
} |
||||
}; |
Loading…
Reference in new issue