Class: Hitbox
Describes a hitbox which is the fundamental abstraction of collision detection in SF2. All damage dealt, with the exception of throws, comes from a hitbox intersecting with another hitbox.
Properties
vulnerable
{Array.<Rect> | undefined}Array of vulnerable hitboxes. The player will take damage if a
vulnerable
hitbox intersects with theattack
hitbox from the other player or a projectile created by the other player.attack
{Rect | undefined}If this hitbox can cause damage this property will be set. If an
attack
hitbox intersect avulnerable
hitbox the attack connects.push
{Rect | undefined}This box is responsible for preventing the players from overlapping. If two players
push
boxes intersect the game will push them apart horizontally until they are no longer intersecting.weak
{Rect | undefined}Some animation frames will have a
weak
hitbox in addition to the standardvulnerable
hitboxes. This deals extra damage in some special cases, but more research needs to be done to enumerate these cases.collision
{Rect | undefined}This box is present only on projectiles. If a projectile collides with another projectile they will both disappear.
damage
{number | undefined}If
attack
is present this property specifies the base damage of the attack.bonus
{Object | undefined}With every attack a small amount of damage may be added randomly. This is an object that contains three properties:
min
,max
, andaverage
which describe the bonus damage range. Note thatmin
can be a negative number.dangerBonus
{Object | undefined}If
(attacker.health <= 60)
then this bonus table will be used instead ofbonus
.dizzy
{number | undefined}The base dizzy damage included in this attack.
dizzyTimeout
{number | undefined}The timeout, in frames, added to the attackee's dizzy clock.
Methods
flipX() → {Hitbox}
Convenience method which returns a copy of this Hitbox
but with all Rect
's flipped.
translate(pointopt, xopt, yopt) → {Hitbox}
Convenience method which returns a copy of this Hitbox
but with all Rect
's translated.
Note: Use either hitbox.translate(position)
or hitbox.translate(x, y)
Parameters
point
{Point}Translate by this position
x
{number}X value to translate
y
{number}Y value to translate