Kaplay.Area
Modules
Comp
Types
areaCompOptions
type areaCompOptions = { shape?: Kaplay.Math.Shape.t, offset?: Kaplay.Vec2.t, scale?: float,}
Fields
shape option < Kaplay.Math.Shape.t >
offset option < Kaplay.Vec2.t >
scale option < float >
Values
addAreaComponent
let addArea: ( Kaplay.Context.t, ~options: areaCompOptions=?,) => Kaplay.Types.comp
Return type
getCollisions
Get all collisions currently happening.
let getCollisions: T.t => array<Kaplay.Collision.t>
Parameters
T.t
Return type
array < Kaplay.Collision.t >
hasPoint
let hasPoint: (T.t, Kaplay.Vec2.t) => bool
Return type
bool
onClick
Register an event runs when clicked
let onClick: (T.t, unit => unit) => unit
Parameters
T.t
unit
unit
Return type
unit
onClickWithController
Register an event runs when clicked
let onClickWithController: (T.t, unit => unit) => Kaplay.KEventController.t
Parameters
T.t
unit
unit
Return type
onCollide
onCollide(t, tag, callback)
Register an event runs once when collide with another game obj with certain tag.
let onCollide: (T.t, string, ('t, Kaplay.Collision.t) => unit) => unit
Return type
unit
onCollideEnd
let onCollideEnd: (T.t, 'tag, 't => unit) => Kaplay.KEventController.t
Parameters
T.t
unit
Return type
onCollideWithController
let onCollideWithController: ( T.t, string, ('t, Kaplay.Collision.t) => unit,) => Kaplay.KEventController.t
Return type
onHover
Register an event runs once when hovered.
let onHover: (T.t, unit => unit) => unit
Parameters
T.t
unit
unit
Return type
unit
onHoverEnd
Register an event runs once when unhovered.
let onHoverEnd: (T.t, unit => unit) => unit
Parameters
T.t
unit
unit
Return type
unit
onHoverEndWithController
Register an event runs once when unhovered.
let onHoverEndWithController: (T.t, unit => unit) => Kaplay.KEventController.t
Parameters
T.t
unit
unit
Return type
onHoverWithController
Register an event runs once when hovered.
let onHoverWithController: (T.t, unit => unit) => Kaplay.KEventController.t
Parameters
T.t
unit
unit