AGK for Pascal
TAgkPhysics.GetFirstContact Method (TAgkSprite, TAgkContact)

Cycles through the list of contacts for the given sprite only.

class function GetFirstContact(const Sprite: TAgkSprite; out Contact: TAgkContact): Boolean; overload; static;
const Sprite: TAgkSprite 
the (1st) sprite to check for physics contacts. 
out Contact: TAgkContact 
receives information about the contact. 

True if a contact exists, or False if there are no contacts.

Use the Contact parameter to get the sprites and location involved in this contact. The TAgkContact.Sprite1 property will return the sprite passed to this method. TAgkContact.Sprite2 returns the other sprite in the contact. When this function returns False, the information in the Contact parameter is undefined. You can move on to the next contact with GetNextContact. Only works on sprites setup for physics.

Copyright (c) 2012. All rights reserved.