| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package game
- import "fmt"
- func (game *Game) gameDirector() {
- defer quit(game)
- // Gameflow stages
- // 1. Place ships
- // 2. Fire shots
- // 3. Win/Lose
- var stage int
- for game.gameover == 0 {
- fmt.Print("Do things")
- stage = 1
- // if stage 1: place ships
- if stage == 1 {
- game.drawScreen()
- // Iterate through Shipsets
- // Place ships in game.leftShips
- for _, ship := range game.shipsets {
- valid := false
- for !valid {
- x, y := 7, 7
- orientation := updown
- game.shipPlace(ship, x, y, orientation)
- game.drawScreen()
- game.doAction(<-game.keypresses)
- }
- }
- }
- // if stage 2: fire shots
- if stage == 2 {
- game.drawScreen()
- fmt.Println("Fire shots")
- }
- }
- }
|