mirror of
https://github.com/NickTheFox99/ChristmOS.git
synced 2026-06-28 16:55:11 -04:00
Fix snow instantiation & position
This commit is contained in:
@@ -5,17 +5,13 @@
|
||||
#include <raylib.h>
|
||||
|
||||
namespace Snow {
|
||||
Snow::Snow() { Snow(GetRandomValue(0, 320)); }
|
||||
Snow::Snow(uint x) { Snow(raylib::Vector2(x, 0)); }
|
||||
Snow::Snow(raylib::Vector2 pos) {
|
||||
position = pos;
|
||||
currCycle = 0;
|
||||
live = true;
|
||||
}
|
||||
Snow::Snow() : Snow(GetRandomValue(0, 320)) {}
|
||||
Snow::Snow(int x) : Snow(raylib::Vector2(x, 0)) {}
|
||||
Snow::Snow(raylib::Vector2 pos) : position(pos) {}
|
||||
|
||||
void Snow::Move() {
|
||||
raylib::Vector2 move;
|
||||
uint hMove = GetRandomValue(0, INV_CHANCE);
|
||||
int hMove = GetRandomValue(0, INV_CHANCE);
|
||||
if (hMove <= 1) {
|
||||
hMove = hMove * 2 - 1;
|
||||
} else {
|
||||
@@ -29,8 +25,9 @@ void Snow::Move() {
|
||||
bool Snow::IsAlive() { return live; }
|
||||
|
||||
void Snow::CheckLive() {
|
||||
if (position.y >= SCREEN_HEIGHT)
|
||||
if (position.y >= SCREEN_HEIGHT) {
|
||||
live = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Snow::Update() {
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Snow {
|
||||
class Snow {
|
||||
public:
|
||||
Snow();
|
||||
Snow(uint x);
|
||||
Snow(int x);
|
||||
Snow(raylib::Vector2 pos);
|
||||
|
||||
void Update();
|
||||
@@ -16,8 +16,8 @@ public:
|
||||
|
||||
private:
|
||||
raylib::Vector2 position;
|
||||
uint currCycle;
|
||||
bool live;
|
||||
uint currCycle = 0;
|
||||
bool live = true;
|
||||
|
||||
inline void Move();
|
||||
inline void CheckLive();
|
||||
|
||||
Reference in New Issue
Block a user