diff --git a/scenes/room/states/room_paused.gd b/scenes/room/states/room_paused.gd new file mode 100644 index 0000000..7eb4cee --- /dev/null +++ b/scenes/room/states/room_paused.gd @@ -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 diff --git a/scenes/room/states/room_paused.gd.uid b/scenes/room/states/room_paused.gd.uid new file mode 100644 index 0000000..d734218 --- /dev/null +++ b/scenes/room/states/room_paused.gd.uid @@ -0,0 +1 @@ +uid://ceevyto3vbq7c diff --git a/scenes/room/states/room_playing.gd b/scenes/room/states/room_playing.gd index d4fb655..2c66829 100644 --- a/scenes/room/states/room_playing.gd +++ b/scenes/room/states/room_playing.gd @@ -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)