spacer graphic
spacer graphic
Montage of games AGS Logo
spacer graphic

 

spacer graphic
Menu
spacer graphic Home
About
News
Features
Download AGS
spacer graphic Games 
Games main page
Award Winners
Picks of the month
Short games
Medium length games
Full length games
In Production
Hints & Tips
Community
Forums
AGSers World Map
Member websites
Chat
Resources
Tutorials
FAQ
Knowledge Base
Downloads
Links
AGS-related links
* AGS Manual
  * Scripting
    * Room functions

AreThingsOverlapping

AreThingsOverlapping(int thing1, int thing2)
Checks whether two characters or objects are overlapping each other on screen. This simply carries out a quick rectangular check on the two things to decide - so if they have large transparent regions around the edges, it may seem to be overlapping too soon.

THING1 and THING2 can either be a CHARID, or can be an object number PLUS 1000. So for example, passing EGO as THING1, and 1004 as THING2, will compare the character EGO with Object 4 in the current room.

Returns 0 if they are not overlapping, or the overlapping amount if they are. This amount is an arbitrary scale, but 1 means they are just about touching, all the way up to higher numbers for more overlappingness.

Calling this function with both the parameters as objects is the same as calling Object.IsCollidingWithObject.

Example:

if (AreThingsOverlapping(1002, EGO)) {
  // code here
}
will run the code if object 2 is overlapping EGO. This could be useful if object 2 was a bullet, for instance.

See Also: Character.IsCollidingWithChar, Object.IsCollidingWithObject


User comments and notes
There are currently no user comments on this page.
The user comment facility is currently disabled.