AreaComp
:The area component.
group
Component Types
area
: {shape
: Shape | nullIf we use a custom shape over render shape.
scale
: Vec2Area scale.
offset
: Vec2Area offset.
cursor
: Cursor | nullCursor on hover.
Collider area info.
collisionIgnore
: Tag[]If this object should ignore collisions against certain other objects.
since
v3000.0
restitution
?: numberRestitution ("bounciness") of the object.
friction
?: numberFriction of the object.
isClicked
(): booleanIf was just clicked on last frame.
isHovering
(): booleanIf is being hovered on.
checkCollision
(other: GameObj<AreaComp>): Collision | nullCheck collision with another game obj.
since
v3000.0
getCollisions
(): Collision[]Get all collisions currently happening.
since
v3000.0
isColliding
(o: GameObj<AreaComp>): booleanIf is currently colliding with another game obj.
isOverlapping
(o: GameObj<AreaComp>): booleanIf is currently overlapping with another game obj (like isColliding, but will return false if the objects are just touching edges).
onClick
(f: () => void, btn?: MouseButton): KEventControllerRegister an event runs when clicked.
since
v2000.1
onHover
(action: () => void): KEventControllerRegister an event runs once when hovered.
since
v3000.0
onHoverUpdate
(action: () => void): KEventControllerRegister an event runs every frame when hovered.
since
v3000.0
onHoverEnd
(action: () => void): KEventControllerRegister an event runs once when unhovered.
since
v3000.0
onCollide
(tag: Tag, f: (obj: GameObj, col?: Collision) => void): KEventControllerRegister an event runs once when collide with another game obj with certain tag.
since
v2001.0
onCollide
(f: (obj: GameObj, col?: Collision) => void): KEventControllerRegister an event runs once when collide with another game obj.
since
v2000.1
onCollideUpdate
(tag: Tag, f: (obj: GameObj, col?: Collision) => void): KEventControllerRegister an event runs every frame when collide with another game obj with certain tag.
since
v3000.0
onCollideUpdate
(f: (obj: GameObj, col?: Collision) => void): KEventControllerRegister an event runs every frame when collide with another game obj.
since
v3000.0
onCollideEnd
(tag: Tag, f: (obj: GameObj) => void): KEventControllerRegister an event runs once when stopped colliding with another game obj with certain tag.
since
v3000.0
onCollideEnd
(f: (obj: GameObj) => void): voidRegister an event runs once when stopped colliding with another game obj.
since
v3000.0
hasPoint
(p: Vec2): booleanIf has a certain point inside collider.
resolveCollision
(obj: GameObj): voidPush out from another solid game obj if currently overlapping.
localArea
(): ShapeGet the geometry data for the collider in local coordinate space.
since
v3000.0
worldArea
(): ShapeGet the geometry data for the collider in world coordinate space.
screenArea
(): ShapeGet the geometry data for the collider in screen coordinate space.