From 444fcfd0d2f3916165ceeab2aaa4a3012af25042 Mon Sep 17 00:00:00 2001 From: Mim Hufford Date: Tue, 1 Jun 2021 17:31:54 +0100 Subject: [PATCH] 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 :) --- Userland/Games/FlappyBug/Game.cpp | 1 - Userland/Games/FlappyBug/Game.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Games/FlappyBug/Game.cpp b/Userland/Games/FlappyBug/Game.cpp index 4e05ba85d5..db44f7ba3b 100644 --- a/Userland/Games/FlappyBug/Game.cpp +++ b/Userland/Games/FlappyBug/Game.cpp @@ -5,7 +5,6 @@ */ #include "Game.h" -#include namespace FlappyBug { diff --git a/Userland/Games/FlappyBug/Game.h b/Userland/Games/FlappyBug/Game.h index 6df9b0b451..936ebd9be8 100644 --- a/Userland/Games/FlappyBug/Game.h +++ b/Userland/Games/FlappyBug/Game.h @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include #include @@ -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