SpriteCollided |
Top Previous Next |
Syntax UINT = SpriteCollided(sprite1 as POINTER,sprite2 as POINTER,OPT bypixel as INT) Description Tests for collisions between two sprites. Parameters sprite1 - A sprite pointer. sprite2 - A sprite pointer. bypixel - Optional. Specifies pixel perfect mode. Return value TRUE if sprites collided or FALSE otherwise. Remarks If bypixel is TRUE then the sprites are compared including transparency (mask color) information and will return TRUE only if a non-transparent pixel on both sprites are overlapping. If bypixel is FALSE then the function will compare the bounding rectangles of the sprites only and return TRUE if any part of the rectangles overlap. The sprites positions on the screen are determined by the internal coordinates set by the MoveSprite command. The current image frame is determined by the current frame set by the SpriteFrame command. The sprites must refer to two different sprites. If the same sprite pointer is used for both sprite1 and sprite2 the function returns FALSE regardless of position. Use SpriteCollidedEx for a position independent collision test that works with a single sprite. See Also: MoveSprite, SpriteCollidedEx Example usage IF SpriteCollided(goodguy, badguy, TRUE) |