beta-1.3/restructure-files (#2)
Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
22
Entities/Map Objects/Entity Spawners/arrow_spawner.gd
Normal file
22
Entities/Map Objects/Entity Spawners/arrow_spawner.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
extends Node
|
||||
|
||||
# Exports
|
||||
@export var player: PlayerCharacter
|
||||
@export var arrow_parent: Node2D
|
||||
|
||||
# Preloads
|
||||
const wooden_arrow_scene: PackedScene = preload("uid://b2wq5m01b68rx")
|
||||
|
||||
# Private Methods
|
||||
func _ready() -> void:
|
||||
var firing_arrow_state: FiringArrowState = player.get_node("State Machine/States/Firing Arrow State")
|
||||
firing_arrow_state.ArrowFired.connect(_on_arrow_fired)
|
||||
|
||||
|
||||
func _on_arrow_fired(fire_position: Vector2, direction: Vector2) -> void:
|
||||
var wooden_arrow := wooden_arrow_scene.instantiate() as BaseProjectile
|
||||
wooden_arrow.SetProjectileStartAndDirection(fire_position, direction)
|
||||
|
||||
if arrow_parent == null:
|
||||
return
|
||||
arrow_parent.add_child(wooden_arrow)
|
||||
Reference in New Issue
Block a user