arcade

package
v0.2.63 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeScore

func ComputeScore(ctx context.Context, rec *arcade.Recording) (int64, error)

Types

type Cloud

type Cloud struct {
	X, Y   float64
	Sprite float64
	Scale  float64
}

type DungeonFloor

type DungeonFloor struct {
	Floor          float64
	SizeX          float64
	SizeY          float64
	RoomData       []*Rect2
	Enemies        []*Entity
	Player         *Entity
	Boss           *Entity
	Door           *Entity
	Items          []*Entity
	FloorMap       [][]TileType
	HasKey         bool
	GotKey         bool
	SpawnedEnemyAt map[[2]int]bool
	Dungeon        *MiteKnight
}

func (*DungeonFloor) CreateEntities

func (d *DungeonFloor) CreateEntities(ctx context.Context) error

func (*DungeonFloor) DestroyItem

func (d *DungeonFloor) DestroyItem(x, z float64)

func (*DungeonFloor) DirToPlayer

func (d *DungeonFloor) DirToPlayer(observer *Entity) arcade.Button

func (*DungeonFloor) DoDamage

func (d *DungeonFloor) DoDamage(ctx context.Context, entity *Entity) error

func (*DungeonFloor) EntityInPos

func (d *DungeonFloor) EntityInPos(x, z float64) *Entity

func (*DungeonFloor) Generate

func (d *DungeonFloor) Generate(ctx context.Context, mk *MiteKnight) error

func (*DungeonFloor) GetRandomEnemy

func (d *DungeonFloor) GetRandomEnemy(ctx context.Context) (EntityType, error)

func (*DungeonFloor) GetRandomPointInRoom

func (d *DungeonFloor) GetRandomPointInRoom(ctx context.Context, roomID int, skipFencepostEmulation bool) (float64, float64, error)

func (*DungeonFloor) HideUnseen

func (d *DungeonFloor) HideUnseen(ctx context.Context) error

func (*DungeonFloor) IsFrontFree

func (d *DungeonFloor) IsFrontFree(x, z float64, dir arcade.Button) bool

func (*DungeonFloor) MoveForward

func (d *DungeonFloor) MoveForward(ctx context.Context, entity *Entity, dir arcade.Button) func(yield func()) error

func (*DungeonFloor) NewEnemy

func (d *DungeonFloor) NewEnemy(ctx context.Context, enemyType EntityType, pos *[2]float64) (*Entity, error)

func (*DungeonFloor) SetCorridors

func (d *DungeonFloor) SetCorridors(ctx context.Context) error

func (*DungeonFloor) SetExtras

func (d *DungeonFloor) SetExtras(ctx context.Context) error

func (*DungeonFloor) TileIsInRoomID

func (d *DungeonFloor) TileIsInRoomID(x, y float64) int

type Entity

type Entity struct {
	HP        float64
	MaxHP     float64
	Score     float64
	X         float64
	Height    float64
	Z         float64
	Ox        float64
	Oz        float64
	RotationZ float64
	Type      EntityType
	Child     *Entity
	Cooldown  float64
	IFrames   float64
	Direction arcade.Button
	FlipX     bool
	Blocking  bool
	Dead      bool
	Dying     bool
	Special   bool
}

type EntityType

type EntityType int
const (
	EntityAnt EntityType = iota
	EntityWizard
	EntityFireball
	EntityRandomEnemy
	EntityPotion
	EntityKey
	EntityDoor
)

type FlowerJourney

type FlowerJourney struct {
	State          *State
	Rules          arcade.FlowerJourneyRules
	GameState      GameState
	Countdown      float64
	Combo          float64
	Invul          float64
	InputCooldown  float64
	Speed          float64
	Progress       float64
	PlayerX        float64
	PlayerY        float64
	PlayerVelocity float64
	ItemX          float64
	ItemY          float64
	ItemEnabled    bool
	EnemyEnabled   bool
	PassedEnemy    bool
	PassedHive     bool
	ItemType       ItemType
	ItemProgress   float64
	EnemyX         float64
	EnemyY         float64
	WallID         int
	CloudID        int
	Walls          []*Wall
	Clouds         []*Cloud
	PausedFor      uint64
	PausedAt       uint64
}

func (*FlowerJourney) CheckCollision

func (fj *FlowerJourney) CheckCollision(x, y, w, h float64) bool

func (*FlowerJourney) Dead

func (fj *FlowerJourney) Dead(isEnemy bool)

func (*FlowerJourney) Done

func (fj *FlowerJourney) Done() bool

func (*FlowerJourney) Generate

func (fj *FlowerJourney) Generate(ctx context.Context) error

func (*FlowerJourney) InitGame

func (fj *FlowerJourney) InitGame(ctx context.Context) error

func (*FlowerJourney) InitRules

func (fj *FlowerJourney) InitRules(ctx context.Context, rec *arcade.Recording) error

func (*FlowerJourney) Logic

func (fj *FlowerJourney) Logic(ctx context.Context) error

func (*FlowerJourney) StartGame

func (fj *FlowerJourney) StartGame(ctx context.Context) error

func (*FlowerJourney) Update

func (fj *FlowerJourney) Update(ctx context.Context) error

func (*FlowerJourney) UseItem

func (fj *FlowerJourney) UseItem()

type GameState

type GameState int
const (
	StateStarting GameState = iota
	StateActive
	StatePaused
	StateEnding
)

type ItemType

type ItemType int
const (
	ItemFlower ItemType = iota
	ItemHoney
)

type MiteKnight

type MiteKnight struct {
	State *State
	Rules arcade.MiteKnightRules

	TimeMin    float64
	TimeSec    float64
	Floor      int
	Floors     []*DungeonFloor
	PauseAt    uint64
	InputDelay float64
	CanInput   bool
	Pause      bool
	Moving     bool
	StopClock  bool
	Winner     bool
}

func (*MiteKnight) Clock

func (mk *MiteKnight) Clock(ctx context.Context) (bool, error)

func (*MiteKnight) Done

func (mk *MiteKnight) Done() bool

func (*MiteKnight) EnemyAI

func (mk *MiteKnight) EnemyAI(ctx context.Context, floor *DungeonFloor) error

func (*MiteKnight) FloorChange

func (mk *MiteKnight) FloorChange(yield func()) error

func (*MiteKnight) Generate

func (mk *MiteKnight) Generate(ctx context.Context) error

func (*MiteKnight) GetInput

func (mk *MiteKnight) GetInput(ctx context.Context, floor *DungeonFloor) error

func (*MiteKnight) InitGame

func (mk *MiteKnight) InitGame(ctx context.Context) error

func (*MiteKnight) InitRules

func (mk *MiteKnight) InitRules(ctx context.Context, rec *arcade.Recording) error

func (*MiteKnight) Logic

func (mk *MiteKnight) Logic(ctx context.Context) error

func (*MiteKnight) StartGame

func (mk *MiteKnight) StartGame(ctx context.Context) error

type Processor

type Processor interface {
	InitRules(context.Context, *arcade.Recording) error
	InitGame(context.Context) error
	Generate(context.Context) error
	StartGame(context.Context) error
	Logic(context.Context) error
	Done() bool
}

type Rect2

type Rect2 struct {
	X0, Y0 float64
	X1, Y1 float64
}

type State

type State struct {
	TickCount uint64
	Score     float64
	Version   [3]uint64

	Inputs           [][]arcade.Button
	ButtonHeld       [10]bool
	ButtonPressed    [10]bool
	ButtonWasPressed [10]uint64

	Coroutines []chan<- chan<- coroutineTick

	FinalRandCount uint64
	RNG            *rng.RNG
}

func (*State) ConsumeButton

func (s *State) ConsumeButton(btn arcade.Button) bool

func (*State) ConsumeButtonAllowRepeat

func (s *State) ConsumeButtonAllowRepeat(btn arcade.Button, delay float64) bool

func (*State) InitInputs

func (s *State) InitInputs(ctx context.Context, rec *arcade.Recording) error

func (*State) InitRand

func (s *State) InitRand(ctx context.Context, rec *arcade.Recording) error

func (*State) Rand

func (s *State) Rand(ctx context.Context, min, max float64) (float64, error)

func (*State) RandCheapf

func (s *State) RandCheapf(ctx context.Context) (float64, error)

func (*State) Randf

func (s *State) Randf(ctx context.Context) (float64, error)

func (*State) RunCoroutines

func (s *State) RunCoroutines(ctx context.Context) error

func (*State) StartCoroutine

func (s *State) StartCoroutine(ctx context.Context, f func(yield func()) error) error

func (*State) UpdateInputs

func (s *State) UpdateInputs(ctx context.Context) error

type TileType

type TileType int
const (
	TileWall TileType = iota
	TileFree
	TileKey
	TilePotion
	TileDoor
	TileStairs
	TileWall2
	TileNone
)

type Wall

type Wall struct {
	X, Y   float64
	Gap    float64
	Passed bool
}

Jump to

Keyboard shortcuts

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