From 02455892dac1d52914e5702fd8e895d5cee1f083 Mon Sep 17 00:00:00 2001 From: FBeans Date: Sat, 21 May 2022 19:07:32 +0100 Subject: Add world, boid and all collision detection --- src/World/World.php | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/World/World.php (limited to 'src/World/World.php') diff --git a/src/World/World.php b/src/World/World.php new file mode 100644 index 0000000..06499e8 --- /dev/null +++ b/src/World/World.php @@ -0,0 +1,57 @@ +width($width); + $this->height($height); + + if (!$name) { + $name = $this->generateName(); + } + + $this->name($name); + } + + public function width(int $width = null): int|World + { + if ($width) { + $this->width = $width; + return $this; + } + + return $this->width; + } + + public function height(int $height = null): int|World + { + if ($height) { + $this->height = $height; + return $this; + } + + return $this->height; + } + + public function name(string $name = null): string|World + { + if ($name) { + $this->name = $name; + return $this; + } + + return $this->name; + } + + protected function generateName() + { + return uniqid('world'); + } +} -- cgit v1.2.3