1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:27:35 +00:00

FlappyBug: Make the obstacle gap position random

The position of the gap in the obstacle is now randomly generated each
time it spawns. The game is more fun to play now :)
This commit is contained in:
Mim Hufford 2021-06-01 17:31:54 +01:00 committed by Linus Groh
parent 811d9722f9
commit 444fcfd0d2
2 changed files with 2 additions and 1 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/Optional.h>
#include <AK/Random.h>
#include <LibGUI/Application.h>
#include <LibGUI/Painter.h>
#include <LibGUI/Widget.h>
@ -77,6 +78,7 @@ private:
void reset()
{
x = game_width;
gap_top_y = get_random_uniform(game_height - gap_height);
}
Gfx::FloatRect top_rect() const