Class: GameHitbox

GameHitbox(r, dx, dy)

GameHibox class. Used for collision detection

Constructor

new GameHitbox(r, dx, dy)

Constructor for GameHibox

Parameters:
Name Type Default Description
r

Radius of the circle

dx number 0

Horizontal deviation from center of the element

dy number 0

Vertical deviation from center of the element

Properties:
Name Type Description
delta Point

Deviation from center point of parent Element

r number

Radius of the hitbox circle

Source:

Methods

copy() → {GameHitbox}

Creates new instance with identical attributes

Source:
Returns:

Copy of this instance

Type
GameHitbox

draw(ctx, center)

Draw function for the hitbox. Draws a coloured circle

Parameters:
Name Type Description
ctx CanvasRenderingContext2D

Context on which the hitbox is drawn

center Point

Center of the parent Element

Source: