Des changements de scènes sans bugs
du moins je l'espère!
This commit is contained in:
@@ -102,7 +102,6 @@ autoplay = true
|
||||
bus = &"player_foot_step"
|
||||
playback_type = 1
|
||||
|
||||
[connection signal="loadFromGameState" from="." to="controleur" method="_on_character_body_2d_load_from_game_state"]
|
||||
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
|
||||
[connection signal="area_entered" from="Area2D" to="controleur" method="_on_declencheur"]
|
||||
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
|
||||
|
||||
@@ -26,10 +26,11 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
human.velocityVector = Vector2(0, 0)
|
||||
human.wants_to_grab = false
|
||||
human.wants_to_interact_with = null
|
||||
if human.pause_everything:
|
||||
return
|
||||
human.velocityVector = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||
if human.velocityVector != Vector2(0, 0):
|
||||
GameState.isUsingTouch = false
|
||||
update_game_state()
|
||||
|
||||
if event.is_action_pressed("grab"):
|
||||
if can_interact_with:
|
||||
@@ -45,9 +46,15 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
pathFinder.destination = get_global_mouse_position()
|
||||
|
||||
func update_game_state():
|
||||
if human.pause_everything:
|
||||
return
|
||||
GameState.update_position(human.get_feet_global_position())
|
||||
GameState.vec_last_facing_direction = human.last_facing_direction
|
||||
|
||||
func _process(delta) -> void:
|
||||
if human.pause_everything:
|
||||
return
|
||||
update_game_state()
|
||||
ray.target_position = human.last_facing_direction * 48
|
||||
|
||||
if human.last_facing_direction.y > 0 :
|
||||
@@ -102,12 +109,11 @@ func _process(delta) -> void:
|
||||
can_interact_with.enable_interaction_clue(human)
|
||||
|
||||
func _on_area_2d_body_entered(body: Node2D) -> void:
|
||||
if human.pause_everything:
|
||||
return
|
||||
if body.has_method("do_trap") :
|
||||
human.kill_path_finder = true
|
||||
body.do_trap()
|
||||
|
||||
func _on_area_2d_body_exited(body: Node2D) -> void:
|
||||
pass
|
||||
|
||||
func _on_character_body_2d_load_from_game_state() -> void:
|
||||
human.set_feet_global_position(GameState.position_outside)
|
||||
|
||||
Reference in New Issue
Block a user