I can not understand about the "world"

Anything libgdx related goes here!

I can not understand about the "world"

Postby TruePlayer » Wed Aug 14, 2019 8:52 pm

if I want to work with Box2D or Box2dLights then scene2d does not suit me? no stage and actors? only a world and bodydef? how then to work in this case with dialogs? I want to show a dialog in case of collisions
TruePlayer
 
Posts: 54
Joined: Sun Jul 28, 2019 12:22 pm

Re: I can not understand about the "world"

Postby tomski » Wed Aug 14, 2019 8:59 pm

Physics simulation has nothing to do with rendering. It can exist as pure numbers in memory, and doesn't have to end up on the screen in any way. How you choose to display a graphical representation of this world is up to you. You could do that with scene2d if you really wanted to. You would have an actor, and set its position/size depending on the box2d body it represents, and update its transform (position & rotation) each frame so the actor is synchronized with the body.

I wouldn't recommend doing that personally, as I dont think you should use Scene2d for gameplay objects.

Your question seems to ask about showing a dialog in the event of a collision? in which case its quite simple, you would have your UI as normal using scene2d.ui, detect the collision (with help of the collision listerers), and simply call some api to pop up a scene2d dialog with whatever info you want. There is no direct link needed for box2d to a dialog.
tomski
 
Posts: 897
Joined: Wed Jun 26, 2013 6:06 pm

Re: I can not understand about the "world"

Postby TruePlayer » Wed Aug 14, 2019 9:13 pm

TNX
TruePlayer
 
Posts: 54
Joined: Sun Jul 28, 2019 12:22 pm


Return to Libgdx

Who is online

Users browsing this forum: No registered users and 1 guest