hi
Every time i started a project using X2 i ended up quieting and switching to another framework but now i started a new project and i am not giving up until i have a finished product.
the thing is that X2 fills like it is missing some stuff and some are unclear so i will use this thread to put some question and this could be helpful for other developers.
i will start with few question but i am sure the list will grow ?
1, if i want to delete a body from the scene i tried to use bw.delete(x2.gs) but it seems like it is deleting the bodywrapper object with its graphics but not the physic body itself so i use a different way the same as in other frameworks
if i check the x2 source i see that the Delete function adds the body to the GameStep BodiesToDelete List but it is not deleted. maybe i am doing something wrong
2, in other framework i have Category BitMask, Collision BitMask and Test BitMask. In X2 i have only Category and Collision Bitmask so Test BitMask is missing.
So why do we need Test Bitmask? The reason is this. Category Bitmask assign a body to a specific Category now we can control wich bodies will collide with the collision Bitmask.
BUT if i want Category 1 to collide with Category 2 but not Collide with Category 3 BUT still get a report of collision i cannot do it without having Test Bit mask. So basically Test Bitmask allow you to still have Collision Report with 2 bodies that will not physically collide with each other. You would say now set the Body to isSensor = true and you have the same effect. Well, wrong because if you set the body to isSensor it will never physicaly collide with any other Body.
3, i am missing a TouchEvent for each body. So Spritekit you can add for each body a touch event. This is really helpful for making Menus using Tiled. In libGDX you have an event that trigger all touches but in X2 you do that in the main Tick(GS as X2GameStep) Event. Now after adding some features you can imagine how long this event can get. It would look much nicer if there would be a specific event only for the Touches.
4, if i create a chainbody in Tiled (so a polygone that is nto closed) it will create it in X2 but i cannot rotate. is this a bug or is this normal?
more question will follow
thanx
Every time i started a project using X2 i ended up quieting and switching to another framework but now i started a new project and i am not giving up until i have a finished product.
the thing is that X2 fills like it is missing some stuff and some are unclear so i will use this thread to put some question and this could be helpful for other developers.
i will start with few question but i am sure the list will grow ?
1, if i want to delete a body from the scene i tried to use bw.delete(x2.gs) but it seems like it is deleting the bodywrapper object with its graphics but not the physic body itself so i use a different way the same as in other frameworks
B4X:
world.DestroyBody(bw.Body)
if i check the x2 source i see that the Delete function adds the body to the GameStep BodiesToDelete List but it is not deleted. maybe i am doing something wrong
B4X:
Public Sub Delete (GS As X2GameStep)
If IsDeleted Then Return
#if Not (X2SkipLogs)
Log($"Deleting body: ${Name}, ${Id}"$)
#end if
IsDeleted = True
GS.BodiesToDelete.Add(Body)
If mGraphicName.StartsWith(X2.GraphicCache.TempPrefix) Then
X2.GraphicCache.RemoveGraphics(mGraphicName)
End If
End Sub
2, in other framework i have Category BitMask, Collision BitMask and Test BitMask. In X2 i have only Category and Collision Bitmask so Test BitMask is missing.
So why do we need Test Bitmask? The reason is this. Category Bitmask assign a body to a specific Category now we can control wich bodies will collide with the collision Bitmask.
BUT if i want Category 1 to collide with Category 2 but not Collide with Category 3 BUT still get a report of collision i cannot do it without having Test Bit mask. So basically Test Bitmask allow you to still have Collision Report with 2 bodies that will not physically collide with each other. You would say now set the Body to isSensor = true and you have the same effect. Well, wrong because if you set the body to isSensor it will never physicaly collide with any other Body.
3, i am missing a TouchEvent for each body. So Spritekit you can add for each body a touch event. This is really helpful for making Menus using Tiled. In libGDX you have an event that trigger all touches but in X2 you do that in the main Tick(GS as X2GameStep) Event. Now after adding some features you can imagine how long this event can get. It would look much nicer if there would be a specific event only for the Touches.
4, if i create a chainbody in Tiled (so a polygone that is nto closed) it will create it in X2 but i cannot rotate. is this a bug or is this normal?
more question will follow
thanx