combat

package module
v0.0.0-...-5a25bdc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2025 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const MaxHitBox = 60

Variables

View Source
var (
	ATTACK_REPOSITORY = map[string]int{}
)

Functions

func NewIR

func NewIR() invincibleReason

Types

type Attack

type Attack struct {
	Name                 string
	ID                   int
	Boxes                [MaxHitBox]HitBoxes `json:"boxes"`
	BoxesPositionOffsets [MaxHitBox][MaxHitBox]vector.Two
	Length               int
	StartTick            int
	Speed                int
	Damage               int
	LRDirection          spatial.Direction
	LastHitTick          int
}

func NewAttack

func NewAttack(name string) Attack

func NewAttacksFromJSON

func NewAttacksFromJSON(embeddedFS fs.FS, fileName string, path string) ([]Attack, error)

func (*Attack) FirstActiveBoxIndex

func (a *Attack) FirstActiveBoxIndex() int

func (*Attack) UnmarshalJSON

func (a *Attack) UnmarshalJSON(data []byte) error

type AttackCollection

type AttackCollection struct {
	Attacks []Attack `json:"attacks"`
}

type AttackSequence

type AttackSequence struct {
	Attacks []Attack
}

func NewAttackSeq

func NewAttackSeq(attacks ...Attack) *AttackSequence

func (AttackSequence) First

func (aSeq AttackSequence) First() Attack

func (AttackSequence) Next

func (aSeq AttackSequence) Next(current Attack) (Attack, bool)

type BufferWindow

type BufferWindow struct {
	Start, End int
}

type Defeat

type Defeat struct {
	StartTick int
}

type Health

type Health struct {
	Value int
}

type HitBox

type HitBox spatial.Shape

type HitBoxPrimitive

type HitBoxPrimitive struct {
	X int `json:"x"`
	Y int `json:"y"`
	W int `json:"w"`
	H int `json:"h"`
}

type HitBoxes

type HitBoxes [MaxHitBox]HitBox

type Hurt

type Hurt struct {
	StartTick int
	Direction vector.Two
}

type HurtBox

type HurtBox struct {
	spatial.Shape
	RelativePos vector.Two
}

func NewHurtBox

func NewHurtBox(width, height, relX, relY float64) HurtBox

type HurtBoxes

type HurtBoxes [10]HurtBox

func NewHurtBoxesFromJSON

func NewHurtBoxesFromJSON(embeddedFS fs.FS, fileName string, path string) (HurtBoxes, error)

func (HurtBoxes) Active

func (hbs HurtBoxes) Active() iter.Seq[HurtBox]

type Invincible

type Invincible struct {
	StartTick int
	Reason    invincibleReason
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL