Box2D Forums

It is currently Sat May 18, 2013 4:13 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Contact Listener Error
PostPosted: Thu Jun 07, 2012 5:04 am 
Offline

Joined: Tue Apr 17, 2012 12:08 am
Posts: 118
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


Top
 Profile  
 
PostPosted: Thu Jun 07, 2012 12:03 pm 
Offline

Joined: Sun Oct 25, 2009 3:28 am
Posts: 242
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.


Top
 Profile  
 
PostPosted: Thu Jun 07, 2012 9:18 pm 
Offline

Joined: Tue Apr 17, 2012 12:08 am
Posts: 118
Hi jay, i will try and let you know if it worked on this very thread, thanks again ....

Jin


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group