Grape.Collidable Class
A class, which can have collision events.
Item Index
Methods
getBottom
()
Number
Returns the bottom axis.
Returns:
the bottom axis
getBounds
()
Object
Gets the left, right, top, bottom coordinates at once.
Returns:
The bounding box coordinates, should contain "left", "right", "top" and "bottom" properties
getGame
()
Grape.Game | Null
Gets the current game instance through the current layer.
Returns:
The current game, or null, if the lookup fails.
getHeight
()
Number
Returns the height (bottom - top).
Returns:
the height, should be bottom - top
getLeft
()
Number
Returns the left axis.
Returns:
the left axis
getRight
()
Number
Returns the right axis.
Returns:
the right axis
getScene
()
Grape.Scene | Null
Gets the root layer.
Returns:
The root layer, or null, if the lookup fails.
getTop
()
Number
Returns the top axis.
Returns:
the top axis
getWidth
()
Number
Returns the width (right - left).
Returns:
the width, should be right - left
onGlobal
-
event
-
handler
Subscribes to an event on the layer the instance is added to. If the instance is not yet added to any layers, it will subscribe when added.
Parameters:
-
event
StringEvent
-
handler
FunctionEvent listener
remove
()
Removes the instance from the layer.