Yes, gui.get_screen_position(node) will give you the position of a node based on the current resolution while gui.get_position(node) will get you the position of the node translated to the resolution specified in game.project.
Example:
- A project with Display Width and Height set to 960 and 640 respectively.
- A single box node positioned in top-right corner with anchor set to top-right:
- In the update function I print both gui.get_position() and gui.get_screen_position():
function update(self, dt)
local node = gui.get_node("box")
print("Position: ", gui.get_position(node), "Screen position: ", gui.get_screen_position(node))
end
- When the window is opened it prints:
DEBUG:SCRIPT: Position: vmath.vector3(960, 640, 0) Screen position: vmath.vector3(960, 640, 0)
- And when the window is resized (made wider) it prints:
DEBUG:SCRIPT: Position: vmath.vector3(960, 640, 0) Screen position: vmath.vector3(1760, 640, 0)
So as you can see, gui.get_screen_position() will give you a position with the size of the current window while gui.get_position() will give you a position that always matches the size of the window as it was set in game.project.
You are animating using gui.animate() right? If yes, then you should still give position in the original window dimensions as set in game.project. You should not worry about giving a position to gui.animate() that reflects current window size.
Using which function?