Parcourir la source

pre-weekend update.

Sacha Ligthert il y a 6 mois
Parent
commit
b442b83a2d
3 fichiers modifiés avec 22 ajouts et 2 suppressions
  1. 1 1
      game/game.go
  2. 20 0
      game/types.go
  3. 1 1
      main.go

+ 1 - 1
game/game.go

@@ -2,6 +2,6 @@ package game
 
 import "fmt"
 
-func GameInit() {
+func GameStart() {
 	fmt.Println("Game Initialized")
 }

+ 20 - 0
game/types.go

@@ -1,5 +1,8 @@
 package game
 
+import "github.com/gdamore/tcell/v3"
+
+// Directions for movement and actions
 const (
 	up = iota
 	Left
@@ -11,3 +14,20 @@ const (
 	downright
 	action
 )
+
+// Styles holds the different styles for the game elements
+type Styles struct {
+	Default tcell.Style
+	ship    tcell.Style
+	hit     tcell.Style
+	miss    tcell.Style
+	sea     tcell.Style
+}
+
+// Game holds the state of the game
+type Game struct {
+	screen     tcell.Screen
+	style      Styles
+	keypresses chan int
+	score      int
+}

+ 1 - 1
main.go

@@ -5,5 +5,5 @@ import (
 )
 
 func main() {
-	game.GameInit()
+	game.GameStart()
 }