This site requires JavaScript, please enable it in your browser!
Greenfoot back
Sciyaps
Sciyaps wrote ...

2012/3/20

How can I make a object "solid"?

Sciyaps Sciyaps

2012/3/20

#
Just wondering, how do I make a object "solid" eg: Make two cars crash into each other instead of them going through one another?
dlanni dlanni

2012/3/20

#
There is a method in Class Actor called getOneIntersectingObject and several others that might fit your situation. You can use these methods to sense when one object intersects another. Maybe make a method based on the ever popular crab scenario's canSee method, whose code is downloadable (although they usually use the less useful getOneObjectAtOffset). My game, PyroTyro, uses the first method. The code is available; just open the House class. After one car "canSee" another (they collide), you can remove both of their images and replace them with a crunched up car image, just as I have replaced my House image with a burning house image after the House canSee the match.
You need to login to post a reply.