AGK for Pascal
TAgkSprite.Collision Method

Checks two sprites for collision, if they overlap then it returns True. Otherwise it returns False. No other information can be returned about this type of collision.

class function Collision(const Sprite1: TAgkSprite; const Sprite2: TAgkSprite): Boolean; static;
const Sprite1: TAgkSprite 
The sprite to check for intersection with Sprite2. 
const Sprite2: TAgkSprite 
The sprite to check for intersection with Sprite1. 

This method is primarily for sprites that are not using physics. Whilst it can be used on physics sprites the physics system will have already calculated the overlap of all physics sprites during the last frame and stored the results in the contact list. This function actually does the calculation required to determine if the sprites overlap. This function is not limited by group or category settings. 

This function only operates on the sprite's base shape. Any additional shapes added to physics sprites will not be used in this function, use PhysicsCollision or PhysicsCollidesWith instead. 

If you have not assigned a shape to either sprite using Shape they will use the default box shape based on the sprite's width and height.

Copyright (c) 2012. All rights reserved.