Options
All
  • Public
  • Public/Protected
  • All
Menu
classdesc

Creates a DuckEngine Hitbox

description

The Hitbox Class. A AABB Hitbox used for Colliders

since

2.0.0

Hierarchy

  • Hitbox

Implements

Index

Constructors

constructor

Properties

collisionState

collisionState: CollisionResponseType
memberof

Hitbox

description

A string determining the state of the current collision

since

2.0.0

culled

culled: boolean
memberof

Hitbox

description

Determines if the Hitbox should be visible by the current scene's current camera

since

2.1.0

debugColor

debugColor: undefined | string
memberof

Hitbox

description

The debug color of the Hitbox, determines if the visibility of the hitbox

since

game

game: Game
memberof

Hitbox

description

Game instance

since

2.0.0

h

h: number
memberof

Hitbox

description

The Height of the Hitbox

since

2.0.0

Readonly id

id: string
memberof

Hitbox

description

The unique identifier for a Hitbox

since

2.0.0

offset

offset: Vector2
memberof

Hitbox

description

The Offset Position of the hitbox

since

2.0.0

physicsObject

memberof

Hitbox

description

PhysicsBody that the Hitbox is attached to

since

2.0.0

position

position: Vector2
memberof

Hitbox

description

The Position of the Hitbox

since

2.0.0

scene

scene: Scene
memberof

Hitbox

description

Scene instance

since

2.0.0

visible

visible: boolean
memberof

Hitbox

description

Determines if the Hitbox will be drawn on the screen as a debug aid

since

2.0.0

w

w: number
memberof

Hitbox

description

The Width of the Hitbox

since

2.0.0

zIndex

zIndex: number
memberof

Hitbox

description

The zIndex of the Hitbox, effects how the Hitbox is layered if it is drawn on the screen as a debug aid

since

2.0.0

Methods

_draw

  • _draw(): void
  • memberof

    Hitbox

    description

    Draws the hitbox if a debugColor is passed in the constructor.

    DO NOT CALL MANUALLY, CALLED IN GAME LOOP USING SCENE.displayList

    since

    2.0.0

    Returns void

_update

auto

  • memberof

    Hitbox

    description

    Auto scales, positions, and offsets the Hitbox based on the shape of the PhysicsBody

    since

    2.0.0

    Parameters

    Returns void

getBottom

  • getBottom(): number

getCenter

getCenterX

  • getCenterX(): number

getCenterY

  • getCenterY(): number

getLeft

  • getLeft(): number

getRight

  • getRight(): number

getTop

  • getTop(): number

groupIntersectsFaceWith

intersectsFaceWith

intersectsWith

  • intersectsWith(hitbox: Hitbox): boolean

scale

setDebugColor

  • setDebugColor(debugColor: string, visible?: boolean): void
  • memberof

    Hitbox

    description

    Sets the debugColor and visibility of the Hitbox as a debug aid

    since

    2.0.0

    Parameters

    • debugColor: string

      Color

    • visible: boolean = true

    Returns void

setPosition

Generated using TypeDoc