character

package
v0.0.0-...-060524d Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionState

type ActionState uint8
const (
	IDLE      ActionState = iota
	ATTACKING ActionState = iota

	// Inactionable
	BLOCKSTUN ActionState = iota
	HITSTUN   ActionState = iota
	KNOCKDOWN ActionState = iota
)

type Boundaries

type Boundaries struct {
	Attackbox Hitbox
	Hurtbox   Hitbox
}

Boundaries is a collection of different types of hitboxes of an entity.

func (Boundaries) Flip

func (b Boundaries) Flip(over sdl.Point) Boundaries

Horizontally flip all hitboxes of an entity over a point.

func (Boundaries) TranslateTo

func (b Boundaries) TranslateTo(moveTo sdl.Point) Boundaries

Move all hitboxes of an entity in the direction of a vector moveTo.

type Character

type Character struct {
	KeyboardControls controls.KeyboardLayout
	Origin           sdl.Point
	State            ActionState
	CurrentMove      *Move
	CurrentMoveFrame uint16
}

func (*Character) GetBoundaries

func (c *Character) GetBoundaries() Boundaries

func (*Character) ProcessActions

func (c *Character) ProcessActions(actions []controls.PlayerAction)

Process player input and translate it into character activity.

func (*Character) StartMove

func (c *Character) StartMove(move *Move)

type Hitbox

type Hitbox []sdl.Rect

Hitbox is an interactable area primarily used to calculate collisions with other entities.

func (Hitbox) Flip

func (hb Hitbox) Flip(over sdl.Point) Hitbox

Horizontally flip all boxes of a hitbox over a point.

func (Hitbox) TranslateTo

func (hb Hitbox) TranslateTo(moveTo sdl.Point) Hitbox

Move all boxes of a hitbox in the direction of a vector moveTo.

type Move

type Move struct {
	// contains filtered or unexported fields
}

func GetPunch

func GetPunch() Move

func (Move) BoundariesFromFrame

func (m Move) BoundariesFromFrame(frame uint16) Boundaries

Given a frame number, calculate Character's Boundaries from the hitbox progression of the move.

func (Move) TotalFrameCount

func (m Move) TotalFrameCount() uint16

Calculate the total frame count of a move, during which a character regularly would not be able to act until it ends.

type MoveState

type MoveState uint8
const (
	STARTUP  MoveState = iota // Has not yet produced an Attackbox, counterable
	ACTIVE   MoveState = iota // Is currently producing Attackboxes, counterable
	RECOVERY MoveState = iota // Finished producing Attackboxes, punishable
)

Jump to

Keyboard shortcuts

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