level = (int)($params['level'] ?? $this->progress->current); parent::enter($params); } protected function items(): array { return [ ['RESUME', null, fn () => $this->scenes()->pop()], ['RESTART', null, fn () => $this->scenes()->switchTo(PlayScene::class, ['level' => $this->level])], ['OPTIONS', null, fn () => $this->scenes()->push(OptionsScene::class)], ['LEVELS', null, fn () => $this->scenes()->switchTo(LevelScene::class, ['level' => $this->level])], ]; } protected function back(): void { $this->scenes()->pop(); } public function update(float $dt): void { if ($this->actions()->isPressed('pause') && !$this->actions()->isPressed('back')) { $this->scenes()->pop(); return; } parent::update($dt); } }