Godot Version
4.2.1
Question
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.
4.2.1
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
move_and_slide()
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.