Scratch for Java

Sprite::setHitbox()

Sets the hitbox for the sprite using the provided points. The points should be provided in pairs representing the x and y coordinates.

Syntax

Java

.setHitbox(points)
.setHitbox(xPoints, yPoints)
.setHitbox(hitbox)
.setHitbox(shape)

Parameters

Name Data Type Description
points double[] an array of integers representing the x and y coordinates of the hitbox vertices. The length of the array should be even, with each pair of integers representing a point (x, y).
xPoints double[] an array of x coordinates for the hitbox
yPoints double[] an array of y coordinar the hitbox
hitbox Hitbox the Hitbox object to set
shape Shape the shape to be used for the hitbox

Return

void

setHitbox()