Initialize HitBox object.
X axis offset from top left.
Y axis offset from top left.
Width of hitbox.
Height of hitbox.
Gets the height of the hitbox.
Gets the width of the hitbox.
Gets the offset along the X axis from top left.
Gets the offset along the Y axis from top left.
Set new values for the hitbox.
X axis offset from top left.
Y axis offset from top left.
Width of hitbox.
Height of hitbox.
Allows for more precise collision detection.
// Creates a hitbox 4 pixels right and down from the top left of the sprite, // with a width of 32 pixels and a height of 40 pixels. player.hitbox = new HitBox(4, 4, 32, 40)