actors

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: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScreenWidth  = 1000
	ScreenHeight = 1000
)

Variables

View Source
var MenuStage = "init"
View Source
var TanksKilled []KillFeedEntry
View Source
var (
	TotalEnemiesNum = 10
)

Functions

func CountNonPlayerTanks

func CountNonPlayerTanks(tanks []Tank) int

func CountPlayerTanks

func CountPlayerTanks(tanks []Tank) int

func HandleCollision

func HandleCollision(tanks *[]Tank, levelObjects []levels.LevelBlock)

func HandleMovement

func HandleMovement(t *Tank)
func MainMenu(tanks *[]Tank, levelNum *int)

func NoEnemiesLeft

func NoEnemiesLeft(tanks []Tank) bool

func NoPlayersLeft

func NoPlayersLeft(tanks []Tank) bool

func ResetCounter

func ResetCounter()

func ResetPlayerPositions

func ResetPlayerPositions(tanks *[]Tank)

func Update

func Update(tanks *[]Tank)

func UpdateEnemyLogic

func UpdateEnemyLogic(tanks *[]Tank, levelObjects []levels.LevelBlock)

Types

type Coordinates

type Coordinates struct {
	X      float64
	Y      float64
	Width  float64
	Height float64
}

type Explosion

type Explosion struct {
	X     float64
	Y     float64
	Frame int
}

type Hull

type Hull struct {
	X             float64
	Y             float64
	PrevX         float64
	PrevY         float64
	Width         float64
	Height        float64
	Angle         float64
	Speed         float64
	ReverseSpeed  float64
	RotationSpeed float64
	Image         string

	CollisionX1 float64
	CollisionY1 float64
	CollisionX2 float64
	CollisionY2 float64
	CollisionX3 float64
	CollisionY3 float64
	CollisionX4 float64
	CollisionY4 float64
}

type KillFeedEntry

type KillFeedEntry struct {
	TankName  string
	TimeAdded time.Time
}

type Point

type Point struct {
	X, Y float64
}

type ProgressBar

type ProgressBar struct {
	X, Y, Width, FilledWidth, Height int
}

type Projectile

type Projectile struct {
	X         float64
	Y         float64
	VelocityX float64
	VelocityY float64
	Angle     float64
	Width     float64
	Height    float64
	Collided  bool
}

Define a projectile struct

type Tank

type Tank struct {
	X               float64
	Y               float64
	MaxHealth       int
	Health          int
	HealthBarWidth  int
	HealthBarHeight int
	Name            string
	Player          bool
	CanMove         bool

	Hull        Hull
	Turret      Turret
	Projectiles []Projectile
	Explosions  []Explosion

	ReloadBarWidth  int
	ReloadBarHeight int

	LastCollisionTime time.Time
}

func AddEnemy

func AddEnemy(tanks []Tank) []Tank

func CheckEnemyCount

func CheckEnemyCount(tanks []Tank) []Tank

func GetUpdatedTankList

func GetUpdatedTankList(tanks []Tank) []Tank

func NewTank

func NewTank(name string) Tank

type Tanks

type Tanks struct {
	Tanks []Tank
}

type Turret

type Turret struct {
	X             float64
	Y             float64
	Width         float64
	Height        float64
	Length        float64
	Angle         float64
	RotationSpeed float64
	Image         string

	ProjectileSpeed float64
	ReloadTime      float64
	ReloadTimer     float64

	ProgressBar ProgressBar
}

type Vector

type Vector struct {
	X float64
	Y float64
}

Jump to

Keyboard shortcuts

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