I created a small programmatic in-game debugger so I could see the player position. However whenever I move the player character on the screen the Velocity updates but the position X and Y remains the default position of the object when I start the scene. Is there a way get the current position of the player object using the onready var functionality? I believe I have provide the relevant data for my player script. Am I missing something about the how the onready var system works?
extends KinematicBody2D
onready var player = $"."
onready var playerPosition = player.position
var velocity = Vector2.ZERO
# Lots of code in-between this function and others
# Lots of code in-between this function and others
# Lots of code in-between this function and others
func UpdateLabel():
var velocityX = velocity.x
var velocityY = velocity.y
var positionX = playerPosition.x
var positionY = playerPosition.y
PlayerDataLabel.text = str(
"Velocity X: ",
stepify(velocityX, 0.01),
"\nVelocity Y: ",
stepify(velocityY, 0.01),
"\nPosition X: ",
stepify(positionX, 0.01),
"\nPosition Y: ",
stepify(positionY, 0.01)
)