game

package
v0.0.0-...-e21dc74 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlayersView     = "playersView"
	RenderablesView = "renderablesView"
	BossesView      = "bossesView"
)

ECS View Lookups

View Source
const (
	GameName = "Baron"
)

Variables

This section is empty.

Functions

func DrawRenderables

func DrawRenderables(g *Game, level Level, screen *ebiten.Image)

Draw images on top of the tiles. Each Renderable has a current position.

func GetDiceRoll

func GetDiceRoll(num int) int

func GetRandomInt

func GetRandomInt(num int) int

func LoadImageFromAssets

func LoadImageFromAssets(name string) *ebiten.Image

Loads an image from the assets folder. Todo: Stop using relative pathing!

func MovePlayer

func MovePlayer(g *Game)

func RegisterBosses

func RegisterBosses(g *Game, renderable *ecs.Component)

func RegisterEntities

func RegisterEntities(game *Game)

Register all of the ECS entities.

func ResetPlayer

func ResetPlayer(g *Game)

Types

type EntityQueryManager

type EntityQueryManager struct {
}

type Game

type Game struct {
	Map   GameMap
	World *world.World

	Player *Player
	// contains filtered or unexported fields
}

func NewGame

func NewGame() *Game

func (*Game) AddTag

func (g *Game) AddTag(key string, elements ...any)

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

func (*Game) Init

func (g *Game) Init()

func (*Game) Layout

func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int)

func (*Game) Update

func (g *Game) Update() error

type GameData

type GameData struct {
	ScreenWidth  int
	ScreenHeight int
	TileWidth    int
	TileHeight   int
}

func NewGameData

func NewGameData() GameData

type GameMap

type GameMap struct {
	CurrentLevel Level
}

func NewGameMap

func NewGameMap() GameMap

type Level

type Level struct {
	Tiles []*MapTile
	// contains filtered or unexported fields
}

func NewLevel

func NewLevel() Level

func (*Level) CreateTiles

func (l *Level) CreateTiles() []*MapTile

func (*Level) DrawLevel

func (l *Level) DrawLevel(screen *ebiten.Image)

func (*Level) GetIndexFromXY

func (l *Level) GetIndexFromXY(x, y int) int

type MapTile

type MapTile struct {
	PixelX   int
	PixelY   int
	Passable bool
	Image    *ebiten.Image
}

func NewTile

func NewTile(x int, y int, passable bool, sprite *ebiten.Image) *MapTile

type Monster

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

type Movable

type Movable struct{}

func (*Movable) Move

func (m *Movable) Move()

type Player

type Player struct {
	Image  *ebiten.Image
	Stats  *PlayerStats
	CurrX  int
	CurrY  int
	IsDead bool
	Deaths int
}

func NewPlayer

func NewPlayer() *Player

func (*Player) Move

func (p *Player) Move()

func (*Player) Revive

func (p *Player) Revive()

func (*Player) TransformHealth

func (p *Player) TransformHealth(diff int)

Apply a damaging effect to the player

type PlayerStats

type PlayerStats struct {
	MaxHealth     int
	CurrentHealth int
	MaxMana       int
	CurrentMana   int
}

type Position

type Position struct {
	X, Y int
}

type Renderable

type Renderable struct {
	Image *ebiten.Image
}

Jump to

Keyboard shortcuts

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