Chipmunk Physics - referring back to types?
BlitzMax Forums/BlitzMax Programming/Chipmunk Physics - referring back to types?
| ||
Hi there, the BlitzMax wrapper for the Chipmunk physics is pretty damn awesome and I'm liking it a lot, I have one issue though. In my game I have type called Titem which contains a field for the items' body & shape. However, I will need for the shape or body to refer back to Titem so it can update it when they collide with other objects. For example, when two objects collide they will need to take damage, the 'damage' field being in Titem. How can I set this up? Am I missing something fundamental? |
| ||
Have uploaded a new version (1.03) which adds support for storing user data in both CPBody and CPShape. Method SetData(data:Object) Method GetData:Object() Note that neither CPBody nor CPShape hold onto a reference to the object themselves, which shouldn't be an problem as you are likely to keep them in your own lists anyway. :o) |
| ||
Awesome, thanks for the speedy update. :) |
| ||
Note that this update can be found at: http://code.google.com/p/maxmods/ |
| ||
Thats great! Thanks alot! |
| ||
What I do is just extend CPBody to make my base game object class but I will have a look at these Data methods. |