FrameBox
namespace Griff.Modules.Fighting;
public struct FrameBoxOne box (or circle) on one frame of an animation clip, as a Hitboxes holds them: a hitbox that deals Damage, Knockback and Stun, or a hurtbox that takes hits times its Multiplier. Its place and size are in the entity’s own units, facing right, as its picture is drawn.
Properties
Section titled “Properties”Center
Section titled “Center”public Vector2 Center { get; init; }Where its middle is, from the entity’s middle, facing right.
public string Clip { get; init; }The clip it’s on, e.g. “Punch”; OwnFrames for the animation’s own frames (or no animation).
Damage
Section titled “Damage”public float Damage { get; init; }A hitbox’s damage, before the hurtbox it lands on multiplies it.
public int Frame { get; init; }Which of the clip’s frames, counting from 0.
public int Group { get; init; }A hitbox’s group: a swing hits something once per group, however many of its frames touch it.
IsCircle
Section titled “IsCircle”public bool IsCircle { get; }True for a circle (it has a Radius); false for a box.
public bool IsHit { get; }public FrameBoxKind Kind { get; init; }Knockback
Section titled “Knockback”public Vector2 Knockback { get; init; }How fast a hitbox sends what it hits flying, in units a second: X away from it, Y up.
Multiplier
Section titled “Multiplier”public float Multiplier { get; init; }A hurtbox’s multiplier for the damage of hits it takes: 1.5 for a head that takes more.
Radius
Section titled “Radius”public float Radius { get; init; }A circle’s radius; 0 for a box.
public Vector2 Size { get; init; }How wide and high a box is; for a circle, as wide and high as the circle.
public int Stun { get; init; }How many steps of the game (frames, at 60 a second) a hitbox leaves what it hits in hitstun.
Methods
Section titled “Methods”AsCircle
Section titled “AsCircle”public FrameBox AsCircle(float radius)The same box as a circle of radius.
Deconstruct
Section titled “Deconstruct”public void Deconstruct(out string Clip, out int Frame, out FrameBoxKind Kind, out Vector2 Center, out Vector2 Size, out float Radius, out float Damage, out Vector2 Knockback, out int Stun, out int Group, out float Multiplier)Equals
Section titled “Equals”public override bool Equals(object obj)Equals
Section titled “Equals”public bool Equals(FrameBox other)FormatAll
Section titled “FormatAll”public static IReadOnlyList<string> FormatAll(IEnumerable<FrameBox> boxes)Writes boxes as Boxes holds them, a line each.
GetHashCode
Section titled “GetHashCode”public override int GetHashCode()Hitbox
Section titled “Hitbox”public static FrameBox Hitbox(string clip, int frame, Vector2 center, Vector2 size, float damage = 1f, Vector2 knockback = default, int stun = 0, int group = 1)A new hitbox, size big.
Hurtbox
Section titled “Hurtbox”public static FrameBox Hurtbox(string clip, int frame, Vector2 center, Vector2 size, float multiplier = 1f)A new hurtbox, size big.
Number
Section titled “Number”public static string Number(float value)A number as lines write it: up to three decimals, with a point whatever the language.
ParseAll
Section titled “ParseAll”public static IReadOnlyList<FrameBox> ParseAll(IEnumerable<string>? lines)Reads lines written like ToString, skipping those that don’t make sense.
ToString
Section titled “ToString”public override string ToString()The line Boxes holds it as, e.g. Punch 2 hit at 0.6,0.3 size 0.5x0.25 damage 3 knockback 4,2 stun 12 or Idle 0 hurt at 0,0.7 radius 0.3 multiplier 1.5: what TryParse reads back. Values left as they are by default (damage 1, group 1, multiplier 1, no knockback or stun) are left out.
TryParse
Section titled “TryParse”public static bool TryParse(string? line, out FrameBox box, out string? problem)Reads a line written like ToString: the clip, the frame, hit or hurt, then at X,Y and size WxH (or radius R), and for a hitbox any of damage, knockback X,Y, stun and group, for a hurtbox multiplier. False (with why in problem) for a line that doesn’t make sense.
Fields
Section titled “Fields”OwnFrames
Section titled “OwnFrames”public const string OwnFramesWhat a line calls the animation’s own frames, played without a clip (and an entity with no animation’s one frame).