Godot Version 4.2.1
Question
Hi
Im new to godot and I’m struggling to rotate my sprite whilst moving it. I want the sprite to simply rotate on its own centre as it moves to its position.
The sprite starts at x550 y710
This is my code:
extends Node2D
var speed = 9
Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
Called every frame. ‘delta’ is the elapsed time since the previous frame.
func _process(delta):
$Sprite2D.position = $Sprite2D.position.move_toward(Vector2(550,350), speed)
if position.y != 350:
speed -= 0.1
rotation_degrees +=1
Currently the rotation seems to be centred on x0 y0.
Any help gratefully received.