i have been trying to figured out how to adapt from the movement tutorials about "player move to mouse" movement into some sort of " dash into mouse " that also has the gimmick where its like "the longer you hold, the further you go" kinda like a golf if that sounds right.
However, the movement mechanic just doesnt move the player in any way. is there anything that i forget to do or i didnt notice, thankyou.
extends KinematicBody2D
onready var power = 1
onready var maxpower = 100
onready var powerexcalator = 0.5
var velocity = Vector2()
var aim_direction = global_position.direction_to(get_global_mouse_position())
func _input(event):
if event.is_action_pressed("click"):
power = clamp(power+powerexcalator, 0, maxpower)
elif event.is_action_released("click"):
velocity = aim_direction*power
power = 1
# warning-ignore:unused_argument
func _physics_process(delta):
velocity = move_and_slide(velocity)