summaryrefslogtreecommitdiff
path: root/whispy_woods.gd
diff options
context:
space:
mode:
Diffstat (limited to 'whispy_woods.gd')
-rw-r--r--whispy_woods.gd55
1 files changed, 49 insertions, 6 deletions
diff --git a/whispy_woods.gd b/whispy_woods.gd
index b5f4058..71fe5a4 100644
--- a/whispy_woods.gd
+++ b/whispy_woods.gd
@@ -17,20 +17,53 @@ func _process(_delta: float) -> void:
pass
+func blow_wind():
+ $BlinkTimer.paused = true
+
+ for i in range(3):
+ $Mouth.play("mouth_shoot")
+
+ var shot = preload("res://air_shot.tscn").instantiate() as Area2D
+ shot.global_position = $Mouth.global_position + Vector2(0, randi() % 8)
+ shot.direction = -1
+ shot.collision_layer = 0
+ shot.set_collision_layer_value(2, true)
+ shot.set_collision_layer_value(10, true)
+ shot.collision_mask = 0
+ shot.set_collision_mask_value(1, true)
+ shot.add_to_group("enemy")
+ get_tree().current_scene.add_child(shot)
+ shot.hit.connect(func(_node):
+ if is_instance_valid(shot):
+ shot.queue_free()
+ )
+ shot.end_of_life.connect(func():
+ await get_tree().create_timer(0.2).timeout
+ if is_instance_valid(shot):
+ shot.queue_free()
+ )
+
+ await get_tree().create_timer(0.25).timeout
+ $Mouth.play("hole_idle")
+ await get_tree().create_timer(0.25).timeout
+
+ $BlinkTimer.paused = false
+
+
func hit_by_projectile(hit_position: Vector2):
var effect_star_scene := preload("res://effect_star.tscn")
for direction in [Vector2(1, 1), Vector2(1, -1), Vector2(-1, -1), Vector2(-1, 1)]:
var effect_star := effect_star_scene.instantiate()
effect_star.global_position = hit_position
get_tree().current_scene.add_child(effect_star)
- var tween := get_tree().create_tween()
- tween.tween_property(
+ var effect_tween := get_tree().create_tween()
+ effect_tween.tween_property(
effect_star,
"global_position",
effect_star.global_position + direction * 16,
0.1
)
- tween.tween_callback(func():
+ effect_tween.tween_callback(func():
effect_star.queue_free()
)
@@ -38,8 +71,8 @@ func hit_by_projectile(hit_position: Vector2):
hp -= 1
+ $EyeLeft.play("eye_closed")
$EyeRight.play("eye_closed")
- $Mouth.play("eye_closed")
$Tear.visible = true
var tween = get_tree().create_tween()
tween.tween_property(self, "modulate", Color(1, 1, 1, 0.2), 0.1)
@@ -50,9 +83,19 @@ func hit_by_projectile(hit_position: Vector2):
if hp > 0:
tween.tween_callback(func():
modulate = Color(1, 1, 1, 1.0)
- $EyeRight.play("eye_open")
- $Mouth.play("mouth_idle")
+ $EyeLeft.play("hole_idle")
+ $EyeRight.play("hole_idle")
$Tear.visible = false
)
elif hp <= 0:
Game.boss_defeated.emit()
+
+
+func _on_blink_timer_timeout() -> void:
+ $EyeLeft.play("blink")
+ $EyeRight.play("blink")
+ await $EyeRight.animation_finished
+ $EyeLeft.play("hole_idle")
+ $EyeRight.play("hole_idle")
+
+ blow_wind()