IsPersonObstructed
From Spheriki
Check if a person would be obstructed at a given position.
Contents |
Usage
- person_name string. The name of the person.
- x number. The x coordinate of the position to check for obstruction.
- y number. The y coordinate of the position to check for obstruction.
- boolean is returned, true if the person would be obstructed at (x, y), false otherwise.
Examples
To check if the person "Jane" was obstructed one pixel to the right:
var janeX = GetPersonX("Jane"); var janeY = GetPersonY("Jane"); if (IsPersonObstructed("Jane", janeX + 1, janeY)) { // She's blocked, do something }
Notes
- A common mistake is to check the current position of a person within the map engine. The map engine automatically prevents persons from overlapping collisions, so unless the person is stuck over an obstruction, this will always return false. Check future positions instead, as in the example code.
See also
- IgnorePersonObstructions()
- IgnoreTileObstructions()
- IsIgnoringPersonObstructions()
- IsIgnoringTileObstructions()
- GetPersonBase()
- GetPersonIgnoreList()
- GetObstructingPerson()
- GetObstructingTile()
- SetPersonIgnoreList()
- GetPersonX()
- GetPersonY()
- MapEngine()