Current screen coordinates of a moving element

Let’s assume that I have an element that has a “Move” effect at onStartScreen. Is it possible for the controller associated to the element to determine the current coordinates on the screen of the element during the execution of the effect?

I tried with getX() and getY() but they seem to provide the final coordinates and not the state of the effect.


You can use te camera to convert from screen coords o world coords and vice versa.

I am not sure to understand how…

I think he means in _Nifty gui the Screenposition for a gui element or? (Still I don’t know how to)

No, you can’t do that! :confused:

The Move effect will take the final position of the element on the screen (the one where the element would be when there are no effects applied) and simply will move the element to that position. When the effect is applied the renderstate is changed with the current offset so that the element - that is rendered after that state is changed - will be rendered offset from its original position.

You can’t query that position while it is moving. I’m sorry.

What you could do is to take a look at the “de.lessvoid.nifty.effects.impl.Move” effect - maybe extend your own effect from it to capture the current value - and then query your object instead. Or take a look at the Move effect and write your own version that does whatever you need. It’s not that hard! The EffectImpl interface is quite simple.