diff options
| author | Aldrik Ramaekers <aldrik@amftech.nl> | 2022-12-18 20:17:16 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik@amftech.nl> | 2022-12-18 20:17:16 +0100 |
| commit | e917400634a535c6c14afc4e37a759f7c777b73a (patch) | |
| tree | 5c8a5de1c6c09985395fbfb660a27500a65d1de0 /src/drops.c | |
| parent | 3e825971102a33dfbb82a20a365684d413bc1ba8 (diff) | |
server tick rate
Diffstat (limited to 'src/drops.c')
| -rw-r--r-- | src/drops.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/drops.c b/src/drops.c index 59bfcc6..95d1af7 100644 --- a/src/drops.c +++ b/src/drops.c @@ -13,14 +13,14 @@ void handle_drop_pickup(player* p, drop* d) { d->active = false; } -void update_drops() { +void update_drops_server() { #define MAX_HEIGHT_DIFF (0.3f) for (int i = 0; i < MAX_DROPS; i++) { drop b = drops[i]; if (!b.active) continue; - drops[i].time_active += update_delta; + drops[i].time_active += SERVER_TICK_RATE; drops[i].position.z = MAX_HEIGHT_DIFF * sin (2 * M_PI * 0.5f * (drops[i].time_active) + 0) + b.start_h; for (int x = 0; x < MAX_PLAYERS; x++) { @@ -49,6 +49,7 @@ void draw_drops(platform_window* window) { if (b.time_active >= DROP_MAX_DURATION - DROP_FADE_TIME) { alpha = 255 - ((b.time_active - (DROP_MAX_DURATION - DROP_FADE_TIME)) / DROP_FADE_TIME)*255; } + if (alpha < 0) alpha = 0; b.position.z = b.start_h; b.size.z = 0.0f; |
