Tuesday, May 10, 2011

Tech Spech Tuesday 5/10/2011


iPhone development is probably the coolest thing I've done in awhile.  That said, I'd like to share a little insider note here.  I've been trying to do hit testing with several balloon characters.  There are several ways one can decide if two balloon characters collide, but the best way in my situation has been to use the wonderful libraries built into Cocoa Touch.  Reading Apple's CGGeometry Reference Guide says it all.  For those that are too impatient to read their documentation, here's the goodies.

1. CGRectContainsPoint( Rectangle, Point )  :   This beauty will return true
if the point is within the rectangle

2. CGRectIntersectsRect( Rectangle, Rectangle )  :  This little number will return true
if the two rectangles are intersecting

What does this mean for a little 2D game?  Testing for hits, both with characters and touches, is REALLY easy.