The Armor Games website will be down for maintenance on Monday 10/7/2024
starting at 10:00 AM Pacific time. We apologize for the inconvenience.

ForumsProgramming ForumCollision Detection Class

5 4160
abarrow
offline
abarrow
22 posts
Nomad

Given Flash's lack of built in collision detection functions I've written an AS3 class that includes many useful and common collision detection methods. From my tests they all work perfectly. Given how much of pain this was to make, I hope other can profit from my code, add suggestions and report bugs if they arise.


http://abarrow.ca/highlighter.php?file=CollisionDetector.as

  • 5 Replies
Theheyjude
offline
Theheyjude
114 posts
Nomad

jeez thats alot of code

PixelSmash
offline
PixelSmash
566 posts
Nomad

Haven't tried it, but it looks like a lot of decent code.

One thing it could still use: comments, and specifically those that help when calling one of the functions. I can't remember the name, but something like /** @param line a line */ function blabla(line):void

Because the code looks great, but it might not always be as clear which function to use at which time

abarrow
offline
abarrow
22 posts
Nomad

Good idea, I've started documenting.

gaboloth
offline
gaboloth
1,612 posts
Peasant

Yeah, it would definitely help me to understand how a perfect pixel collision works

abarrow
offline
abarrow
22 posts
Nomad

I've documented the class at:
http://www.abarrow.ca/cd/CollisionDetector.html

Showing 1-5 of 5