GXEntityCollisionOffset - boxgaming/gx GitHub Wiki
Sets the collision offset for a specified entity. By default the collision rectangle is set to the border of the entity as defined by its height and width. A smaller or larger area can be defined for collision detection with this method.
Syntax
GXEntityCollisionOffset entityId%, left%, top%, right%, bottom%
Parameters
- Entity to animate is specified by the entityId% parameter. This id is returned by the GXEntityCreate function or can be accessed by its user id by the GX function.
- Positive values passed to the left%, top%, right% and bottom% will inset the bounding box by the specified number of pixels. Specifying negative values for these parameters will create a collision rectangle that is outset from the original entity image border.
Examples
Example1: Create an entity and set its collision offset.
DIM SHARED warhog AS LONG
warhog = GXEntityCreate("img/warhog.png", 16, 16, 5)
GXEntityCollisionOffset warhog, 10, 4, 4, 0