Collisions
Monkey Forums/Monkey Beginners/Collisions
| ||
New to the forums here. Was wondering if anybody could point me to info on collisions. Preferably with the module diddy. |
| ||
I'm not sure if diddy has anything built in for collisions, but it's easy enough to quickly do some basic shape detection like distance's or circle to circle or rect to rect etc.Function emCirclesOverlap:bool(p1x:Float,p1y:Float,p1r:float,p2x:Float,p2y:Float,p2r:float) if emDistance(p1x,p1y,p2x,p2y)<=p1r+p2r then return True else return false endif End Function IN terms of pixel perfect collisions, some one just recently posted a module that does it, you can find it in the modules forum, I think for most quick collision checks however something simple like the above will be good enough. |
| ||
Thanks that'll do the job. Just wondering, once you set a variable as Global how can you access it from other classes, for Instance accessing a global list from another class ? |
| ||
Just make sure the file containing the second class directly or indirectly imports the one containing the first class. myglobals.monkey Global theAliens:List< Alien > game.monkey import myglobals '... For Local alien:Alien = Eachin theAliens ' Do alien stuff etc. |