52 lines
1.0 KiB
GDScript3
52 lines
1.0 KiB
GDScript3
|
@tool
|
||
|
extends Event2D
|
||
|
|
||
|
# var prev_stage := 0
|
||
|
# var stage := 0
|
||
|
|
||
|
|
||
|
func _ready() -> void:
|
||
|
super._ready()
|
||
|
if Engine.is_editor_hint():
|
||
|
return
|
||
|
|
||
|
|
||
|
func _on_global_stage_updated(e: StringName, s: int):
|
||
|
super._on_global_stage_updated(e, s)
|
||
|
|
||
|
|
||
|
func _on_ground_ready(_ground: Ground2D):
|
||
|
var ambush = $"Ambush疯子慌张跑开"
|
||
|
# 如果已经跑开过,直接显示纸人
|
||
|
if ambush.played:
|
||
|
$"../左侧纸人".visible = true
|
||
|
else:
|
||
|
ambush.triggered.connect(_on_ambush_triggered)
|
||
|
|
||
|
|
||
|
func _on_ambush_triggered() -> void:
|
||
|
SceneManager.lock_player()
|
||
|
var pro_sprite = $"Pro疯子慌张跑开"
|
||
|
pro_sprite.play("疯子_慌张转身")
|
||
|
pro_sprite.position_updated.connect(_on_pro_sprite_position_updated)
|
||
|
await Util.wait(4.0)
|
||
|
EventManager.set_stage(event_name, 1)
|
||
|
SceneManager.unlock_player()
|
||
|
# $"../左侧纸人".visible = true
|
||
|
|
||
|
|
||
|
var paperman_x = 24
|
||
|
|
||
|
|
||
|
func _on_pro_sprite_position_updated(g_position: Vector2) -> void:
|
||
|
if g_position.x <= paperman_x:
|
||
|
$"../左侧纸人".visible = true
|
||
|
|
||
|
|
||
|
func _on_pre_stage_updated():
|
||
|
pass
|
||
|
|
||
|
|
||
|
func _on_stage_updated():
|
||
|
pass
|