How to make an Node2d move forward

Godot Version



I have a scene with the root node being a Node2D, I want to know how to make the bullet go forward depending on the rotation of the bullet. The game is top down 2D.

I have figured out how to do it, I just changed it to a character body 2d and used the following code:

extends CharacterBody2D

@export var speed = 100

func _ready():
   rotation = PI
   rotation_degrees = 0

func _physics_process(delta):
   velocity = Vector2(1, 0).rotated(rotation) * speed * delta

1 Like