why i cannot create a body like this:
i know i can create a body via Tiled and X2BodyWrapper but why is this code that works in libgdx and in other frameworks that use box2d is working but using xui2d it is not?
B4X:
Sub createBody
Dim playerShape As B2CircleShape
playerShape.Initialize(5)
Dim playerFixtureDef As B2FixtureDef
playerFixtureDef.Shape = playerShape
playerFixtureDef.Density = 1
playerFixtureDef.Restitution = 0.3
playerFixtureDef.Friction = 0.4
Dim playerDef As B2BodyDef
playerDef.BodyType = playerDef.TYPE_DYNAMIC
playerDef.Position.Set(0,0)
Dim playerBody As B2Body
playerBody = world.CreateBody(playerDef)
playerBody.CreateFixture(playerFixtureDef)
End Sub
i know i can create a body via Tiled and X2BodyWrapper but why is this code that works in libgdx and in other frameworks that use box2d is working but using xui2d it is not?
Waiting for debugger to connect...
Program started.
Size scale: 1.07
1
1
*** MainLoop starting. ResumableIndex = 1
Error occurred on line: 131 (X2Utils)
java.lang.NullPointerException
at b4j.example.x2utils$ResumableSub_MainLoop.resume(x2utils.java:1618)
at b4j.example.x2utils._mainloop(x2utils.java:1381)
at b4j.example.x2utils._start(x2utils.java:317)
at b4j.example.game._startgame(game.java:129)
at b4j.example.main._appstart(main.java:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at b4j.example.main.start(main.java:38)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)