登录
ZH
games/doom-jumphp / src / Scene / HelpScene.php · commit 8e1cb9f
<?phpnamespace App\Scene;use JumPHP\Renderer\Renderer;use JumPHP\Ui\MenuScene;/** The controls. */final class HelpScene extends MenuScene{    protected string $title = 'HOW TO PLAY';    protected float $titleScale = 2.0;    protected float $menuTop = 0.86;    public function isOverlay(): bool    {        return true;    }    protected function items(): array    {        return [['BACK', null, fn () => $this->back()]];    }    protected function back(): void    {        $this->scenes()->pop();    }    public function render(Renderer $r): void    {        $r->fillRect(0, 0, $this->width(), $this->height(), [0, 0, 0, 215]);        $lines = [            'ARROWS / W S      MOVE AND TURN',            'A D  (Q D)        STRAFE',            'SHIFT             RUN',            'CTRL / F / CLICK  FIRE',            'SPACE / E         OPEN DOORS, SWITCHES, LIFTS',            '1 - 5             WEAPONS',            'TAB               MAP',            'ESCAPE            PAUSE',            '',            'FIND THE KEYCARDS, OPEN THE DOORS,',            'REACH THE EXIT OF EACH LEVEL.',        ];        foreach ($lines as $i => $line) {            $this->font()->draw($r, $line, 30, 50 + $i * 10, 1, $i < 8 ? [230, 230, 230] : [255, 200, 120]);        }        parent::render($r);    }    protected function renderBackground(Renderer $r): void    {    }}