generated from sigonasr2/CPlusPlusProjectTemplate
29 lines
631 B
C++
29 lines
631 B
C++
|
#include "pixelGameEngine.h"
|
||
|
#include "Meteos.h"
|
||
|
|
||
|
extern Meteos*game;
|
||
|
|
||
|
void Star::Update(){
|
||
|
pos+=spd;
|
||
|
if (pos.x<0){
|
||
|
pos.x+=game->ScreenWidth();
|
||
|
}
|
||
|
if (pos.x>game->ScreenWidth()){
|
||
|
pos.x-=game->ScreenWidth();
|
||
|
}
|
||
|
if (pos.y<0){
|
||
|
pos.y+=game->ScreenHeight();
|
||
|
}
|
||
|
if (pos.y>game->ScreenHeight()){
|
||
|
pos.y-=game->ScreenHeight();
|
||
|
}
|
||
|
|
||
|
if (flickerTimer++>=flickerRate){
|
||
|
flickerTimer=0;
|
||
|
brightness={redDistribution(game->gen),greenDistribution(game->gen),blueDistribution(game->gen)};
|
||
|
}
|
||
|
};
|
||
|
|
||
|
void Star::Draw(){
|
||
|
game->FillRectDecal(pos,size,brightness);
|
||
|
};
|