0 votes

enter image description hereHi. Currently I'm doing a platformer game. However Im stuck on how to do an effect for example when the player collect a gem, it will instance a sprite node and will tween towards the gems UI (Label node). Please see picture.

HUD to world coordinates

rectglobalposition will always return a same value. So I'm not sure how do I convert it to world coordinates ? Please help me. Thanks

asked Jul 22 in Projects by takhimi (15 points)

1 Answer

0 votes
Best answer

Maybe do it the other way around - reparent the coin to the HUD then convert world coordinates into screen coordiantes:

coin.get_parent().remove_child(coin)
hud.add_child(coin)
coin.global_position = get_global_transform_with_canvas().origin
answered Jul 22 by Dlean Jeans (3,615 points)
selected Jul 22 by takhimi

Thanks man. This is what I want.

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.