-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
114 lines (95 loc) · 1.78 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package trisnake
import tl "github.com/JoelOtter/termloop"
//Game Object Variables.
var sg *tl.Game
var sp *Sidepanel
var gs *Gamescreen
var ts *Titlescreen
var gop *Gameoptionsscreen
// Own created types.
type direction int
type difficulty int
type colorobject int
// Game options
var Difficulty = "Normal"
var ColorObject = "Snake"
const (
easy difficulty = iota
normal
hard
)
const (
snake colorobject = iota
food
arena
)
const (
up direction = iota
down
left
right
)
type Titlescreen struct {
tl.Level
Logo *tl.Entity
GameDifficulty difficulty
OptionsText []*tl.Text
}
type Gameoverscreen struct {
tl.Level
Logo *tl.Entity
Finalstats []*tl.Text
OptionsBackground *tl.Rectangle
OptionsText []*tl.Text
}
type Gameoptionsscreen struct {
tl.Level
StartText *tl.Text
CurrentColorObjectText *tl.Text
ObjectBackground *tl.Rectangle
ColorObjectOptions []*tl.Text
CurrentDifficultyText *tl.Text
DifficultyBackground *tl.Rectangle
DifficultyOptions []*tl.Text
ColorPanelBackground *tl.Rectangle
ColorPanelOptions []string
ColorSelectedIcon *tl.Text
}
type Gamescreen struct {
tl.Level
FPS float64
Score int
SnakeEntity *Snake
FoodEntity *Food
ArenaEntity *Arena
SidepanelObject *Sidepanel
}
type Sidepanel struct {
Background *tl.Rectangle
Instructions []string
ScoreText *tl.Text
SpeedText *tl.Text
DifficultyText *tl.Text
}
type Arena struct {
*tl.Entity
Width int
Height int
ArenaBorder map[Coordinates]int
}
type Snake struct {
*tl.Entity
Direction direction
Length int
Bodylength []Coordinates
Speed int
}
type Food struct {
*tl.Entity
Foodposition Coordinates
Emoji rune
}
type Coordinates struct {
X int
Y int
}