//NewStatus creates a new status display for the specified PlayerMech func NewStatus(x, y, width, height int, level *tl.BaseLevel) *Status { display := Status{ background: tl.NewRectangle( x, y, width, height, tl.ColorBlack), level: level, x: x, y: y, } return &display }
func main() { //Create the game game := tl.NewGame() //Create the level for the game level := tl.NewBaseLevel(tl.Cell{ Bg: tl.ColorGreen, Fg: tl.ColorBlack, Ch: ' ', }) level.AddEntity(tl.NewRectangle(10, 10, 50, 20, tl.ColorBlue)) //Create the notification display notification := display.NewNotification(25, 0, 45, 6, level) //Create the enemy mechs enemies := GenerateEnemyMechs(8) for _, enemy := range enemies { enemy.AttachGame(game) enemy.AttachNotifier(notification) level.AddEntity(enemy) } //Create the player's mech player := mech.NewPlayerMech("Player", 10, 1, 1, level) weapon1 := weapon.CreateRifle() player.AddWeapon(weapon1) player.SetEnemyList(enemies) player.AttachGame(game) player.AttachNotifier(notification) level.AddEntity(player) //Create the players mech status display status := display.NewPlayerStatus(0, 0, 20, 13, player, level) //Attach the displays the the level level.AddEntity(status) level.AddEntity(notification) //Set the level to be the current game level game.Screen().SetLevel(level) game.SetDebugOn(false) //Start the game engine game.Start() }