From d7c85bc110043236a29acb84efbf5d8c45a70b37 Mon Sep 17 00:00:00 2001 From: Ivor Barhansky Date: Sun, 20 Feb 2022 23:12:11 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D0=BB(=D0=B0)=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20'src?= =?UTF-8?q?/Insallah/Player'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ivor Barhansky --- src/Insallah/Player/Player.php | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/Insallah/Player/Player.php diff --git a/src/Insallah/Player/Player.php b/src/Insallah/Player/Player.php new file mode 100644 index 0000000..1687f9d --- /dev/null +++ b/src/Insallah/Player/Player.php @@ -0,0 +1,45 @@ += 0) { + $_SESSION['x'] += $x_pos; + } + } + + /** + * @param int $y_pos + */ + public static function modYPos(int $y_pos): void + { + if ($_SESSION['y'] + $y_pos >= 0) { + $_SESSION['y'] += $y_pos; + } + } + + public static function clear() + { + session_destroy(); + header('Location: ' . $_SERVER['REQUEST_URI']); + } +} \ No newline at end of file