startX = $this->x; $this->startY = $this->y; $this->direction = $block === 0x52 ? -1 : 1; } protected function tick(array $player): void { if ($this->delay > 0) { if (--$this->delay === 0) { $this->sounds[] = SoundManager::SFX_FIREBALL; } return; } $this->x += $this->direction; // the original puts it back once it is off-screen (Sonic is about at the middle of the screen) if (abs($this->x - self::heroX($player)) > 160) { $this->x = $this->startX; $this->y = $this->startY; $this->delay = 0x96; } } public function getHurtBox(): ?array { return $this->delay > 0 ? null : self::box($this->x + 2, $this->y + 4, 4, 10); } public function render(float $cameraX, float $cameraY): void { if ($this->delay > 0) return; $this->blit($this->direction < 0 ? self::LEFT : self::RIGHT, $this->x, $this->y, $cameraX, $cameraY); } }