-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscreens.go
113 lines (85 loc) · 2.87 KB
/
screens.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
package main
import (
"fmt"
"github.com/charmbracelet/lipgloss"
)
func titleScreen(width, height int, gameTiles tiles) string {
text := "CEMETERY ESCAPE"
description := "You " + styles.blue.Render(gameTiles.player) + " must escape the cemetery.\n" +
"Search tombstones " + styles.blue.Render(gameTiles.tombstone) + " to find the key.\n" +
"Then head for the door " + styles.blue.Render(gameTiles.door) + ",\n" +
"but watch out for ghosts " + styles.blue.Render(gameTiles.ghost) + ".\n\n"
description += `RECOMMENDATIONS:
- A Nerd Font (https://www.nerdfonts.com/)
- A dark color scheme terminal
MOVE ARROW KEYS
PAUSE P
CHANGE TILES F
QUIT Q`
descriptionStyle := lipgloss.NewStyle().
PaddingTop(1).
PaddingRight(0).
PaddingBottom(1).
PaddingLeft(0)
screen := lipgloss.JoinVertical(
lipgloss.Center,
styles.subtleOrange.Render(text),
descriptionStyle.Render(description),
"PRESS ANY KEY TO START",
)
screen = lipgloss.PlaceHorizontal(width, lipgloss.Center, screen)
screen = lipgloss.PlaceVertical(height, lipgloss.Center, screen)
return screen
}
func winScreen(width, height int, gameTiles tiles) string {
text := "CONGRATULATIONS!\n YOU ESCAPED!\n\n " + gameTiles.ghost + " " + gameTiles.ghost
email := styles.magenta.Render("[email protected]")
screen := lipgloss.JoinVertical(
lipgloss.Center,
styles.subtleOrange.Render(text),
"\nWhy not send me an email at\n"+email+"\nto let me know what\nyou thought of the game?\n\n\nPRESS Q TO EXIT",
)
screen = lipgloss.PlaceHorizontal(width, lipgloss.Center, screen)
screen = lipgloss.PlaceVertical(height, lipgloss.Center, screen)
return screen
}
func deathScreen(width, height int) string {
text := `A GHOST GOT YOU`
screen := lipgloss.JoinVertical(
lipgloss.Center,
styles.subtleOrange.Render(text),
"\nPRESS "+styles.magenta.Render("A")+" TO TRY THE LEVEL AGAIN\n\nPRESS Q TO QUIT",
)
screen = lipgloss.PlaceHorizontal(width, lipgloss.Center, screen)
screen = lipgloss.PlaceVertical(height, lipgloss.Center, screen)
return screen
}
func pausedScreen(width, height int) string {
text := "PAUSED"
screen := lipgloss.JoinVertical(
lipgloss.Center,
styles.subtleOrange.Render(text),
"\nPRESS "+styles.magenta.Render("P")+" TO CONTINUE PLAYING",
)
screen = lipgloss.PlaceHorizontal(width, lipgloss.Center, screen)
screen = lipgloss.PlaceVertical(height, lipgloss.Center, screen)
return screen
}
func tooZoomedIn(width, height int) string {
text := `Your screen is too small!
Try zooming out a bit.
`
screen := lipgloss.PlaceHorizontal(width, lipgloss.Center, text)
screen = lipgloss.PlaceVertical(height, lipgloss.Center, screen)
return screen
}
func help() {
text := `
CEMETERY ESCAPE
Cemetery Escape is a game that you can play in your terminal.
It was created by Tom.
Get in touch!
`
fmt.Println(text)
}