19 lines
417 B
GDScript
19 lines
417 B
GDScript
extends Node3D
|
|
|
|
|
|
@export var ball_scene : PackedScene
|
|
var count = 0
|
|
|
|
|
|
func shoot(spawn_position ,direction = Vector3.FORWARD, strength = 7):
|
|
count += 1
|
|
print(count)
|
|
var ball = ball_scene.instantiate()
|
|
|
|
ball.linear_velocity = direction * strength
|
|
ball.position = spawn_position
|
|
|
|
# Add the ball to the highest node of the scene so it's not parented to the player
|
|
get_tree().root.get_child(0).add_child(ball)
|
|
|