-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaw_event.gd
45 lines (35 loc) · 1.39 KB
/
maw_event.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
extends Node
onready var cutscenes = owner.get_node("Cutscenes")
onready var main_camera = owner.get_node("Camera")
onready var player = owner.get_node("Emma")
onready var boss = owner.get_node("Nhizi")
onready var maw = $Maw
func _on_AnimationPlayer_animation_started(anim_name):
if anim_name in ["L_grasp", "R_grasp"]:
player.global_transform.origin = $EmmaMawPosition.global_transform.origin
player.set_state("idle_swallowed")
maw.get_node("AnimationPlayer").play("stand", 0)
func _on_CutscenesAnimationPlayer_animation_finished(anim_name):
if anim_name == "swallow":
boss.health_bar.hide()
player.health_bar.hide()
maw.get_node("HealthBar").show()
cutscenes.get_node("AnimationPlayer").play("inside", 0)
if anim_name == "spitout":
main_camera.make_current()
func _on_HealthBar_value_changed(value):
var health_bar = maw.get_node("HealthBar")
if value == 0:
health_bar.hide()
player.set_state("swallowed")
maw.get_node("AnimationPlayer").play("swallow", 0)
cutscenes.get_node("AnimationPlayer").play("inside_swallowed", 0)
if value == health_bar.max_value:
cutscenes.get_node("AnimationPlayer").play("spitout", 0)
boss.health_bar.show()
boss.get_node("States")._change_state("spitout")
player.health_bar.show()
maw.get_node("HealthBar").hide()
func _on_Nhizi_spitout_frame():
player.global_transform.origin = $EmmaSpitoutPosition.global_transform.origin
player.stun()