add room paused state
This commit is contained in:
parent
9d9bacb8c9
commit
cbc83e8d20
3 changed files with 24 additions and 3 deletions
17
scenes/room/states/room_paused.gd
Normal file
17
scenes/room/states/room_paused.gd
Normal 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
|
||||
1
scenes/room/states/room_paused.gd.uid
Normal file
1
scenes/room/states/room_paused.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ceevyto3vbq7c
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue