Games Continuous Contact X2

developer_123

Active Member
Licensed User
Longtime User
Good day. Perhaps the concern I have is quite basic, since I am in the process of understanding the functionalities of Tiled and X2. In the development of my application I have managed to identify some collisions and generate events of my characters when they start using the "SUB World_BeginContact". Also when the collisions end I have created a couple of events in the "Sub World_EndContact". The drawback I have now is that I don't know how to generate events during collisions, that is, not when it is generated, nor when it ends, but during the collision. Then I explain:

My character walks on the floor and collides with an object called a spring. After my character collides with the spring, I need him to wait a while (for this I activate a timer). After the time is up , I need to identify if my character is still in contact with the spring (that is, during the wait they did not separate), and if so, then my character should jump.

The drawback I have is that in the "SUB BeginContact" I only identify the first time a character collides with a spring, but after the time has elapsed, if my character is still in contact with the spring, I don't know how to detect that it is still in contact.

I hope I have been clear, and I believe that the solution should not be difficult, only that I do not know the procedure to achieve it. I appreciate any hints.
 

ilan

Expert
Licensed User
Longtime User
In the endcontact event u can know when body has no more contact. So as long the end contact has not be fired he is still in contact.

just use a Boolean when he collide and set it to true. In endcontact set it to false now u can check the boolean status when ever u like.

Btw i would not use a timer in a box2d game use the update event of xui2d instead.
 
Top