Class: MovableObject

MovableObject()

Represents a movable object in the game.

Constructor

new MovableObject()

Source:

Members

offset

Offset for collision detection.
Source:

Methods

applyGravity()

Applies gravity to the object.
Source:

clearAllIntervals()

Clears all stoppable intervals.
Source:

handleHitResult(currentTime)

Handles the result of a hit, updating energy and hit status.
Parameters:
Name Type Description
currentTime number The current time in milliseconds.
Source:

hit()

Reduces the object's energy when hit.
Source:

hitEndboss()

Reduces the object's energy when Endboss hit.
Source:

isAboveGround() → {boolean}

Checks if the object is above the ground.
Source:
Returns:
True if the object is above the ground, false otherwise.
Type
boolean

isColliding(mo) → {boolean}

Checks if the object is colliding with another object.
Parameters:
Name Type Description
mo MovableObject The other movable object.
Source:
Returns:
True if the objects are colliding, false otherwise.
Type
boolean

isCollidingJumping(mo) → {boolean}

Checks if the object is colliding with another object while jumping.
Parameters:
Name Type Description
mo MovableObject The other movable object.
Source:
Returns:
True if the objects are colliding while jumping, false otherwise.
Type
boolean

isDead() → {boolean}

Checks if the object is dead.
Source:
Returns:
True if the object is dead, false otherwise.
Type
boolean

isHurt() → {boolean}

Checks if the object is hurt.
Source:
Returns:
True if the object is hurt, false otherwise.
Type
boolean

jump()

Makes the object jump.
Source:

moveLeft()

Moves the object to the left.
Source:

moveRight()

Moves the object to the right.
Source:

noHit()

Sets the object to a no-hit state for a short duration.
Source:

setStoppableInterval(fn, time)

Sets a stoppable interval.
Parameters:
Name Type Description
fn function The function to execute.
time number The interval time in milliseconds.
Source: