Contact Listener Error

Hi,

I have just started working on box2d and was trying to get a grasp of things by following a few online tutorials, now in one tutorial every thing was going on well and the flash file was also working well till i opened it in flash cs4 and compiled it it gave the following error ---

1020: Method marked override must override another method.

Now when looked in to my code is was something like this ---

//////////////////////////////////////////////////////////////////////////////////////////

override public function Add(point:b2ContactPoint):void
{
jumpable(point);
super.Add(point);
}

override public function Remove(point:b2ContactPoint):void
{
LevelVars.jump = false;
super.Remove(point);
}

override public function Persist(point:b2ContactPoint):void
{
jumpable(point);
}

///////////////////////////////////////////////////////////////////////////////////////

But when i looked in to my box2d dynamics folder and inside the b2ContactListener.as file these methods were not present, so i download an older version of Box2d the 2.0 version , there the methods mentioned above are given as virtual....

Now when i run, i get this error plus a whole lot of warnings ---

1067: Implicit coercion of a value of type Box2D.Collision.Shapes:b2FilterData to an unrelated type Box2D.Dynamics:b2FilterData.

and a whole lot of warning on b2Proxy,b2Math,b2Pair etc.....

can any one help me here as to how to solve the problem....



i have been really trying hard with box2d , but there are no books or clear solutions to any problems i can find, if any one of your experienced people can please guide me to a working resource with many example i will be really grateful......

Jin
Sounds like you included Box2D 2.0 along side with Box2D 2.1a, or you just grabbed the b2ContactListener.as file from the Box2D 2.0 library and replaced 2.1a's copy. There's no b2FilterData in 2.0, which is one of the many big differences between 2.0 and 2.1.

Another change, as you may have already witnessed, is the b2ContactListener class. The "Add(point:b2ContactPoint)" function is "BeginContact(point:b2Contact)" in 2.1a; The "Remove:(point:b2ContactPoint)" function is "EndContact(point:b2Contact)"; and the "Persist" function is sort of turned into PreSolve and PostSolve (emphasis on sort of).

If you simply want the sample to run, remove the 2.1a library and add the 2.0 library. The two versions are largely different. It may also prove useful to get tutorials that are based on the 2.1a library. If you find a tutorial that only runs in the 2.0 library, run it with the 2.0 library and/or read and understand the code and concept so you can integrate it in your own game that runs in the 2.1a library.
Hi jay, i will try and let you know if it worked on this very thread, thanks again ....

Jin

Original thread: https://box2d.org/forum/viewtopic.php?t=8556