0 votes

So, I'm new to Godot and I have a little battle RPG going on. Whenever you walk into an enemy, you get sent to a different scene, but once you go back, you get sent back to the starting point where the character is originally in the game.

Does anyone have any useful code or information to help me:
a) store the location of my character
b) use this location to send my character to the exact location?

I am using Godot 3.2

asked Mar 4 in Engine by Team Xeno (12 points)

1 Answer

+2 votes

For 2D there's position & global_position. For 3D there's translation, transform.origin & global_transform.origin. Each have set and get methods.
Examples of each.

var pos = sprite.get_global_position()
var pos = kinematic_body.get_translation()
answered Mar 4 by Magso (2,469 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.