Hello, so I have been trying to get a basic movement system down in order to experiment on a few other features that I want to figure out. The movement system is grid based, with only a forward and back movement, and rotation by 90 degrees. I have the rotation down, and I can move up and down, however I am uncertain how to connect the movement direction to the objects orientation after rotating. Thanks, here is the code that I have so far.
`extends CharacterBody2D
var forward_vector = Vector2(0,1)
var the_object = self
var orientation_global = (the_object.to_global(forward_vector) - the_object.global_position)
func _ready():
pass
func process(delta):
var curr_pos = the_object.position
if Input.is_action_just_pressed("accelerate"):
the_object.global_position = curr_pos + Vector2(0,105)
if Input.is_action_just_pressed("decelerate"):
the_object.global_position = curr_pos + Vector2(0,105)
if Input.is_action_just_pressed("rotate_left"):
rotation_degrees -= 90
if Input.is_action_just_pressed("rotate_right"):
rotation_degrees += 90
`