#Assign a knife a velocity

4 messages · Page 1 of 1 (latest)

next creek
#

Hey everyone, I'm trying to make a game where the player throws knives by clicking and dragging. I've figured out a system to throw the knives in the right direction, but I'm a little lost on how to actually let them fly.

If I have a KnifeThrower node that does all the input tracking and a separate knife scene I can instantiate, how do I let that knife fly in the direction I want?

sour tulip
#

you can give the knife a script and move it in it like so

var speed := 800

func _physics_process(delta) -> void:
 var dir = Vector2.RIGHT.rotated(rotation)
 position += dir * speed * delta
next creek
#

I didn't know about _physics_process yet, thank you! I managed to get it to work now!