add room paused state

This commit is contained in:
yuki 2025-11-23 08:50:04 -03:00
parent 9d9bacb8c9
commit cbc83e8d20
3 changed files with 24 additions and 3 deletions

View file

@ -0,0 +1,17 @@
extends RoomState
var _prev_state: String
func _enter(previous_state_path: String, _data: Dictionary = {}) -> void:
print("entering room pause")
_prev_state = previous_state_path
get_tree().paused = true
print("room paused")
func _handle_input(event: InputEvent) -> void:
if event.is_action_pressed("pause"):
finished.emit(_prev_state)
return

View file

@ -0,0 +1 @@
uid://ceevyto3vbq7c

View file

@ -3,10 +3,13 @@ extends RoomState
func _enter(_previous_state_path: String, _data: Dictionary = {}) -> void:
print("entering room gameplay")
get_tree().paused = false
func _handle_input(event: InputEvent) -> void:
if event.is_action_pressed("pause"):
finished.emit(PAUSED)
func _state_physics_update(delta: float) -> void:
room.camera.follow_player(delta)
if Input.is_action_just_pressed("pause"):
finished.emit(PAUSED)