generated from sigonasr2/CPlusPlusProjectTemplate
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
631 B
29 lines
631 B
2 years ago
|
#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);
|
||
|
};
|