Meteos/Star.cpp
2023-03-02 17:29:28 +00:00

28 lines
607 B
C++

#include "gameDefines.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);
};