Search code examples
libgdx

How to update multiple actor's position at the same time in libgdx


im currently trying to update a multiple actor's position in libgdx. at first i did it on render event but it made fps slow. Now im updating the libgdx on a different thread but render is getting called halfway while im updating the possitions. is there a way where i can update all of the possitions and render it when they are all ready?


Solution

  • If the actors have different positions we can use addAction(Actions.moveTo(x,y)).

    However, if they are relative to one another, it's better to group them using scene2d ui group class and then update that group's position using addAction(Actions.moveTo(x,y)).