Hatch Game Engine Documentation v1.4.0
The documentation for the Hatch Game Engine
Loading...
Searching...
No Matches
TileCollision Class Reference

Basic functions for performing collision with scene tiles. More...

Public Member Functions

boolean Point (number x, number y)
 Checks for a tile collision at a specified point.
integer PointExtended (number x, number y, integer collisionField, integer collisionSide)
 Checks for a tile collision at a specified point.
boolean Line (number x, number y, SensorDirection directionType, integer length, integer collisionField, integer compareAngle, Entity entity)
 Checks for a tile collision in a straight line.

Detailed Description

Basic functions for performing collision with scene tiles.

Member Function Documentation

◆ Line()

boolean TileCollision.Line ( number x,
number y,
SensorDirection directionType,
integer length,
integer collisionField,
integer compareAngle,
Entity entity )

Checks for a tile collision in a straight line.

Parameters
xX position to start checking from.
yY position to start checking from.
directionTypeOrdinal direction to check in.
lengthHow many pixels to check.
collisionFieldLow (0) or high (1) field to check.
compareAngleOnly return a collision if the angle is within 0x20 of this value. If angle comparison is not desired, pass -1 to this parameter.
entityEntity to write the values to.
Returns
Returns true if tile collision happened, and sets Entity.SensorCollided, Entity.SensorX, Entity.SensorY, and Entity.SensorAngle. Otherwise, just returns false.

◆ Point()

boolean TileCollision.Point ( number x,
number y )

Checks for a tile collision at a specified point.

Parameters
xX position to check.
yY position to check.
Returns
Returns a boolean value.

◆ PointExtended()

integer TileCollision.PointExtended ( number x,
number y,
integer collisionField,
integer collisionSide )

Checks for a tile collision at a specified point.

Parameters
xX position to check.
yY position to check.
collisionFieldLow (0) or high (1) field to check.
collisionSideWhich side of the tile to check for collision. (TOP = 1, RIGHT = 2, BOTTOM = 4, LEFT = 8, ALL = 15)
Returns
Returns the angle of the ground if successful, -1 if otherwise.