TR
games/doom-jumphp / src / Scene / SkillScene.php · commit 8e1cb9f
<?phpnamespace App\Scene;use App\Game\Campaign;use JumPHP\Ui\MenuScene;/** Difficulty, then the first level. */final class SkillScene extends MenuScene{    protected string $title = 'CHOOSE YOUR FATE';    protected float $titleScale = 2.0;    protected float $menuTop = 0.45;    public function isOverlay(): bool    {        return true;    }    protected function items(): array    {        $items = [];        foreach (Campaign::SKILLS as $skill => $label) {            $items[] = [$label, null, fn () => $this->scenes()->switchTo(PlayScene::class, ['level' => Campaign::LEVELS[0], 'skill' => $skill])];        }        $items[] = ['BACK', null, fn () => $this->back()];        return $items;    }    public function enter(array $params = []): void    {        parent::enter($params);        $this->menu->move(1);    }    protected function renderBackground(\JumPHP\Renderer\Renderer $r): void    {        $r->fillRect(0, 0, $this->width(), $this->height(), [0, 0, 0, 225]);    }    protected function back(): void    {        $this->scenes()->pop();    }}