The_Dark_Side_of_Earth/items/consumables/bow/bow.gd

22 lines
636 B
GDScript3
Raw Normal View History

extends ActiveItem
@export var cooldown = 0.3
@export var arrow_scene : PackedScene
2025-10-12 18:26:36 +02:00
func actually_collect():
player.set_cooldown(cooldown)
func activate():
player.activate_cooldown()
2025-10-12 18:26:36 +02:00
# Spawn an arrow on activation
var arrow : Area2D = arrow_scene.instantiate()
get_tree().get_root().add_child(arrow)
arrow.position = player.position
arrow.rotation = player.rotation
arrow.direction = player.get_node("EarthAligner").right * player.facing
2025-10-12 18:26:36 +02:00
# Make sure the arrow sprite faces the right direction
if(player.facing == -1):
arrow.get_node("Sprite2D").scale.x = - arrow.get_node("Sprite2D").scale.x
2025-09-19 14:42:16 +02:00
$SoundBowRelease.play()