Map screen version
This commit is contained in:
@@ -71,6 +71,8 @@ var _result_win: bool = false
|
||||
var _over_root: Control
|
||||
var _over_video: VideoStreamPlayer
|
||||
var _over_label: Label
|
||||
var _over_continue: Button
|
||||
var _over_again: Button
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -214,7 +216,10 @@ func _find_spawner() -> void:
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event is InputEventKey and event.pressed and not event.echo:
|
||||
if _game_over and event.physical_keycode in [KEY_ENTER, KEY_KP_ENTER]:
|
||||
_restart()
|
||||
if _result_win:
|
||||
_continue_to_map()
|
||||
else:
|
||||
_restart()
|
||||
elif event.physical_keycode == KEY_TAB and not _game_over:
|
||||
_toggle_controls()
|
||||
elif event.physical_keycode == KEY_ESCAPE:
|
||||
@@ -233,6 +238,14 @@ func _restart() -> void:
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
|
||||
# A cleared arena advances the run: commit the win and open the map to pick the next node.
|
||||
func _continue_to_map() -> void:
|
||||
get_tree().paused = false
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
Run.complete_current_level()
|
||||
get_tree().change_scene_to_file("res://MapScreen.tscn")
|
||||
|
||||
|
||||
func _toggle_controls() -> void:
|
||||
_controls_visible = not _controls_visible
|
||||
_toggle_btn.text = "Hide controls" if _controls_visible else "Show controls"
|
||||
@@ -311,6 +324,9 @@ func _show_game_over(win: bool, _cause: String = "") -> void:
|
||||
await get_tree().create_timer(_WIN_DELAY if win else _LOSS_DELAY, false, false, true).timeout
|
||||
|
||||
_over_label.text = "Bull Won!" if _result_win else "Matadors Won!"
|
||||
# A win advances the run (on to the map); a loss ends it (retry from the top).
|
||||
_over_continue.visible = _result_win
|
||||
_over_again.visible = not _result_win
|
||||
|
||||
var path := _WIN_VIDEO if _result_win else _LOSS_VIDEO
|
||||
if ResourceLoader.exists(path):
|
||||
@@ -381,9 +397,15 @@ func _build_game_over() -> void:
|
||||
row.offset_bottom = -48.0
|
||||
_over_root.add_child(row)
|
||||
|
||||
var again := _make_button("Go Again (Enter)")
|
||||
again.pressed.connect(_restart)
|
||||
row.add_child(again)
|
||||
# Win → Continue to the run map; loss → Go Again from the top. Shown per-result in
|
||||
# _show_game_over; both share the Enter shortcut.
|
||||
_over_continue = _make_button("Continue (Enter)")
|
||||
_over_continue.pressed.connect(_continue_to_map)
|
||||
row.add_child(_over_continue)
|
||||
|
||||
_over_again = _make_button("Go Again (Enter)")
|
||||
_over_again.pressed.connect(_restart)
|
||||
row.add_child(_over_again)
|
||||
|
||||
var menu := _make_button("Main Menu")
|
||||
menu.pressed.connect(_return_to_menu)
|
||||
|
||||
Reference in New Issue
Block a user