levels

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScreenWidth  = 1000
	ScreenHeight = 1000
)

Variables

View Source
var Blocks []Block
View Source
var LevelObjects []LevelBlock

Functions

func DeformBlock

func DeformBlock(block *LevelBlock, side string)

func GetLevelLayout

func GetLevelLayout(levelNumber int) []string

func IsBaseDestroyed

func IsBaseDestroyed(levelObjects []LevelBlock) bool

func SetHealth

func SetHealth(brick *LevelBlock, health int)

Update object health after it gets shot

func UpdateLevelObjects

func UpdateLevelObjects(levelObjects []LevelBlock)

Types

type Block

type Block struct {
	Walls []Line
}

func (Block) Points

func (b Block) Points() [][2]float64

type Image

type Image struct {
	X      int
	Y      int
	Width  int
	Height int
	Path   string
}

type LevelBlock

type LevelBlock struct {
	X, Y          float64
	Width, Height float64
	Blocks        []Block
	Destructible  bool
	Collidable    bool
	Base          bool
	Health        int
	Border        bool
	Image         Image
}

func AddLevelBlock

func AddLevelBlock(x, y int, blockType string) LevelBlock

func AddLevelBorder

func AddLevelBorder(x, y, w, h int) LevelBlock

func GetLevelObjects

func GetLevelObjects(levelNum int) []LevelBlock

func PlayerBaseLevelBlock

func PlayerBaseLevelBlock() LevelBlock

PlayerBaseLevelBlock returns a LevelBlock instance with player base coordinates

type Line

type Line struct {
	X1, Y1, X2, Y2 float64
}

func (*Line) Angle

func (l *Line) Angle() float64

Jump to

Keyboard shortcuts

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