Hope someone can help, trying to fire an arrow on an arc. You've all seen this code before with one line added to make a basic arc. I would like better control of the arc or to round it off slightly, not to mention, faking the arc is done in a way by adding to the velocity.y and this works fine on most angles but when firing up makes the arrow go faster due to the negative value added to the y. So really i need a round arc and to control the speed so the time taken for the short and long flights are reflected in the correct amount of time.
I think there's a way of using follow path 2d but i had trouble with achieving this through code.
HELP!!
extends KinematicBody2D
export (int) var speed = 500
var target = Vector2()
var velocity = Vector2()
func _ready():
target = position
pass
func _input(event):
if event.is_action_pressed('click'):
target = get_global_mouse_position()
func _physics_process(delta):
velocity = (target - position).normalized() * speed
#rotation = velocity.angle()
velocity.y -= 200
if (target - position).length() > 5:
velocity = move_and_slide(velocity)