Interface MobContext

A representation of any mob in the game from the view of a Mod.

Hierarchy

  • MobContext

Properties

blocksMovement: boolean

True if this mob should block movement

data: Record<string, any>

Generic user data that the mod can store things per mod in

gravity: number

The gravity to apply to this mob

id: string

The unique ID of the mob

name: string

The name of the mob - displayed above their head

state: MobState

The state of this mod - this describes what happened last frame

vx: number

The horizontal velocity of the mob

vy: number

The vertical velocity of the mob

x: number

The x co-ordinate the mob's position given in world units (tiles are 128 pixels)

y: number

The y co-ordinate the mob's position given in world units (tiles are 128 pixels)

Methods

  • True if this mob is a player

    Returns boolean

  • Set the control state of the mob. Changing these controls will cause the mob to move, jump or use items as with any player.

    Parameters

    • left: boolean

      True if the mob is trying to move left

    • right: boolean

      True if the mob is trying to move right

    • up: boolean

      True if the up button is pressed (e.g. jump)

    • down: boolean

      True if the down button is pressed (e.g. down ladder)

    Returns void

Generated using TypeDoc