Prettified the Game UI
This commit is contained in:
parent
b5e38d09de
commit
8e843d4e6c
1 changed files with 57 additions and 34 deletions
91
main.go
91
main.go
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
)
|
)
|
||||||
|
|
||||||
// These are variables for embeding files - dont remove them, they just look like comments
|
// =-=-=-=-=-= These are variables for embeding files as hardcoded strings - dont remove them, they just LOOK like comments =-=-=-=-=-=-=
|
||||||
|
|
||||||
//go:embed menu.txt
|
//go:embed menu.txt
|
||||||
var menu string
|
var menu string
|
||||||
|
|
@ -42,32 +42,42 @@ var hitTheStreets string
|
||||||
//go:embed levels/doctorsRoom.txt
|
//go:embed levels/doctorsRoom.txt
|
||||||
var doctorsRoom string
|
var doctorsRoom string
|
||||||
|
|
||||||
// End File Ebeds
|
// =-=-=-=-=-=-= End File String Embeds =-=-=-=-=-=-=
|
||||||
|
|
||||||
// other variables - keep these from mixing with above embed strigs - its a weird go thing
|
// Game Variables - Core Gameplay
|
||||||
var stats string
|
var stats string // variable for stats generation output
|
||||||
var statsCombat string
|
var statsCombat string // variable used for combat stats during fights
|
||||||
var PlayerName string
|
var PlayerName string // player's name...
|
||||||
var condoms = 0
|
var condoms = 0 // its better to have them and not need them
|
||||||
var std = false
|
var std = false // what happens if you have connies
|
||||||
var money = 1800
|
var money = 1800 // not specific currency
|
||||||
var experience = 100
|
var days = 30 // total number of days (default 30)
|
||||||
var level = 1
|
var experience = 0 // your experience from combat battle fights (starts at 0)
|
||||||
var whores = 1
|
var level = 1 // your level from combat battle fights (starts at 1)
|
||||||
var cocaines = 0
|
var whores = 1 // number of sex slaves you own
|
||||||
var fentanyl = 0
|
var cocaines = 0 // cocaine in 1/gram units
|
||||||
var LSD = 0
|
var fentanyl = 0 // fentanyl in 500 miligram units
|
||||||
var bumfights = 25
|
var LSD = 0 // LSD in pills
|
||||||
|
var bumfights = 25 // number of homeless bum fights per day
|
||||||
|
|
||||||
|
// Lipgloss - Props to
|
||||||
var border = lipgloss.NewStyle().
|
var border = lipgloss.NewStyle().
|
||||||
BorderStyle(lipgloss.NormalBorder()).
|
BorderStyle(lipgloss.NormalBorder()).
|
||||||
BorderForeground(lipgloss.Color("63"))
|
BorderForeground(lipgloss.Color("63"))
|
||||||
|
|
||||||
var storyBorder = lipgloss.NewStyle().
|
var titleStyle = lipgloss.NewStyle().
|
||||||
|
BorderStyle(lipgloss.NormalBorder()).
|
||||||
|
BorderForeground(lipgloss.Color("#f20b0bff")).
|
||||||
|
Foreground(lipgloss.Color("#ffffffff ")).
|
||||||
|
Background(lipgloss.Color("#f20b0bff"))
|
||||||
|
|
||||||
|
var storyStyle = lipgloss.NewStyle().
|
||||||
BorderStyle(lipgloss.NormalBorder()).
|
BorderStyle(lipgloss.NormalBorder()).
|
||||||
Width(75).
|
Width(75).
|
||||||
BorderForeground(lipgloss.Color("228")).
|
BorderForeground(lipgloss.Color("228")).
|
||||||
BorderBackground(lipgloss.Color("#0000FF"))
|
BorderBackground(lipgloss.Color("#0000FF")).
|
||||||
|
Foreground(lipgloss.Color("#ffffffff ")).
|
||||||
|
Background(lipgloss.Color("#0000FF"))
|
||||||
|
|
||||||
var statsStyle = lipgloss.NewStyle().
|
var statsStyle = lipgloss.NewStyle().
|
||||||
BorderStyle(lipgloss.NormalBorder()).
|
BorderStyle(lipgloss.NormalBorder()).
|
||||||
|
|
@ -75,20 +85,20 @@ var statsStyle = lipgloss.NewStyle().
|
||||||
Background(lipgloss.Color("#2a2a60ff"))
|
Background(lipgloss.Color("#2a2a60ff"))
|
||||||
|
|
||||||
var red = lipgloss.NewStyle().
|
var red = lipgloss.NewStyle().
|
||||||
Foreground(lipgloss.Color("#ffffffff ")).
|
Foreground(lipgloss.Color("#f20b0bff"))
|
||||||
Background(lipgloss.Color("#f20b0bff"))
|
|
||||||
|
|
||||||
var pink = lipgloss.NewStyle().
|
var pink = lipgloss.NewStyle().
|
||||||
Foreground(lipgloss.Color("#ee00e2ff "))
|
Foreground(lipgloss.Color("#ee00e2ff "))
|
||||||
|
|
||||||
var green = lipgloss.NewStyle().
|
var green = lipgloss.NewStyle().
|
||||||
Foreground(lipgloss.Color("#18e60aff ")).
|
Foreground(lipgloss.Color("#18e60aff "))
|
||||||
Background(lipgloss.Color("#55576aff"))
|
|
||||||
|
|
||||||
|
// why the fuck does golang not do this - should work on win10/11 (yes it does support ansi escape codes *now*)
|
||||||
func ClearScreen() {
|
func ClearScreen() {
|
||||||
fmt.Print("\033[H\033[2J")
|
fmt.Print("\033[H\033[2J")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cool stylized Enter key masher
|
||||||
func MashEnterKey() {
|
func MashEnterKey() {
|
||||||
fmt.Println(statsStyle.Render("Mash the 'Enter' key!"))
|
fmt.Println(statsStyle.Render("Mash the 'Enter' key!"))
|
||||||
bufio.NewReader(os.Stdin).ReadBytes('\n')
|
bufio.NewReader(os.Stdin).ReadBytes('\n')
|
||||||
|
|
@ -105,13 +115,13 @@ func HitTheStreets() {
|
||||||
choice := ""
|
choice := ""
|
||||||
for i < 1 {
|
for i < 1 {
|
||||||
ClearScreen()
|
ClearScreen()
|
||||||
fmt.Println(storyBorder.Render(hitTheStreets))
|
fmt.Println(storyStyle.Render(hitTheStreets))
|
||||||
fmt.Println("Your choice,")
|
fmt.Println("Your choice,")
|
||||||
fmt.Print(green.Render(PlayerName), ">")
|
fmt.Print(green.Render(PlayerName), ">")
|
||||||
fmt.Scan(&choice)
|
fmt.Scan(&choice)
|
||||||
if strings.ToUpper(choice) == "B" {
|
if strings.ToUpper(choice) == "B" {
|
||||||
ClearScreen()
|
ClearScreen()
|
||||||
fmt.Println(storyBorder.Render("Bum Fight!"))
|
fmt.Println(storyStyle.Render("Bum Fight!"))
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Println("You encounter a ", red.Render("homeless piece of shit!"))
|
fmt.Println("You encounter a ", red.Render("homeless piece of shit!"))
|
||||||
fmt.Println("")
|
fmt.Println("")
|
||||||
|
|
@ -161,7 +171,7 @@ func RedRoom() {
|
||||||
i := 0
|
i := 0
|
||||||
choice := ""
|
choice := ""
|
||||||
for i < 1 {
|
for i < 1 {
|
||||||
fmt.Println(storyBorder.Render(redRoom))
|
fmt.Println(storyStyle.Render(redRoom))
|
||||||
fmt.Println("Your choice,")
|
fmt.Println("Your choice,")
|
||||||
fmt.Print(green.Render(PlayerName), ">")
|
fmt.Print(green.Render(PlayerName), ">")
|
||||||
fmt.Scan(&choice)
|
fmt.Scan(&choice)
|
||||||
|
|
@ -292,13 +302,13 @@ func DoctorsOffice() {
|
||||||
choice := ""
|
choice := ""
|
||||||
for i < 1 {
|
for i < 1 {
|
||||||
ClearScreen()
|
ClearScreen()
|
||||||
fmt.Println(storyBorder.Render(doctorsRoom))
|
fmt.Println(storyStyle.Render(doctorsRoom))
|
||||||
fmt.Println("Your choice,")
|
fmt.Println("Your choice,")
|
||||||
fmt.Print(green.Render(PlayerName), ">")
|
fmt.Print(green.Render(PlayerName), ">")
|
||||||
fmt.Scan(&choice)
|
fmt.Scan(&choice)
|
||||||
if strings.ToUpper(choice) == "C" {
|
if strings.ToUpper(choice) == "C" {
|
||||||
ClearScreen()
|
ClearScreen()
|
||||||
fmt.Println(storyBorder.Render("Doctor's Miracle STD/STI Cures"))
|
fmt.Println(storyStyle.Render("Doctor's Miracle STD/STI Cures"))
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Println("You encounter ", red.Render("the doctor."))
|
fmt.Println("You encounter ", red.Render("the doctor."))
|
||||||
fmt.Println("")
|
fmt.Println("")
|
||||||
|
|
@ -354,7 +364,7 @@ func PropertyRoom() {
|
||||||
i := 0
|
i := 0
|
||||||
choice := ""
|
choice := ""
|
||||||
for i < 1 {
|
for i < 1 {
|
||||||
fmt.Println(storyBorder.Render(propertyRoom))
|
fmt.Println(storyStyle.Render(propertyRoom))
|
||||||
fmt.Println("Your choice,")
|
fmt.Println("Your choice,")
|
||||||
fmt.Print(green.Render(PlayerName), ">")
|
fmt.Print(green.Render(PlayerName), ">")
|
||||||
fmt.Scan(&choice)
|
fmt.Scan(&choice)
|
||||||
|
|
@ -448,7 +458,7 @@ func PropertyRoom() {
|
||||||
func ClockOut() {
|
func ClockOut() {
|
||||||
choice := 0
|
choice := 0
|
||||||
ClearScreen()
|
ClearScreen()
|
||||||
fmt.Println(storyBorder.Render(wifey))
|
fmt.Println(storyStyle.Render(wifey))
|
||||||
for choice < 1 {
|
for choice < 1 {
|
||||||
fmt.Println("Your choice,")
|
fmt.Println("Your choice,")
|
||||||
fmt.Print(green.Render(PlayerName), ">")
|
fmt.Print(green.Render(PlayerName), ">")
|
||||||
|
|
@ -488,11 +498,24 @@ func ClockOut() {
|
||||||
default:
|
default:
|
||||||
choice = 0
|
choice = 0
|
||||||
}
|
}
|
||||||
|
ClearScreen()
|
||||||
|
fmt.Println(border.Render("It is a new day!"))
|
||||||
|
if days == 0 {
|
||||||
|
fmt.Println("You have run out of days...")
|
||||||
|
MashEnterKey()
|
||||||
|
|
||||||
|
}
|
||||||
|
days = days - 1
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GameOver() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func CheckStats() {
|
func CheckStats() {
|
||||||
stats = "PLAYER STATS" + "\n\n" + "Name " + "\n" + PlayerName + "\n" + "Condoms: " + strconv.Itoa(condoms) + "\n" + "Money: $" + strconv.Itoa(money) + "\n" + "Whores:" + strconv.Itoa(whores) + "\n" + "Cocaine (1 gram bags): " + strconv.Itoa(cocaines) + "\n" + "Fentanyl (100/mg bags): " + strconv.Itoa(fentanyl) + "\n" + "LSD (tabs): " + strconv.Itoa(LSD) // builds the stats paragraph for the main screen
|
stats = "PLAYER STATS" + "\n\n" + "Name " + "\n" + PlayerName + "\n" + "Condoms: " + strconv.Itoa(condoms) + "\n" + "Money: $" + strconv.Itoa(money) + "\n" + "Whores:" + strconv.Itoa(whores) + "\n" + "Cocaine (1 gram bags): " + strconv.Itoa(cocaines) + "\n" + "Fentanyl (100/mg bags): " + strconv.Itoa(fentanyl) + "\n" + "LSD (tabs): " + strconv.Itoa(LSD) + "\n" + "Days Left: " + strconv.Itoa(days) // builds the stats paragraph for the main screen
|
||||||
}
|
}
|
||||||
|
|
||||||
func CombatStats() {
|
func CombatStats() {
|
||||||
|
|
@ -555,19 +578,19 @@ func MainMachine() {
|
||||||
|
|
||||||
func ScreenMachine() {
|
func ScreenMachine() {
|
||||||
CheckStats()
|
CheckStats()
|
||||||
fmt.Println(border.Render("OPP Wars - Corruption"))
|
fmt.Println(storyStyle.Render("OPP Wars - Corruption"))
|
||||||
fmt.Println(lipgloss.JoinHorizontal(lipgloss.Top, border.Render(menu), statsStyle.Render(stats))) // makes a horizontal display joining two paras
|
fmt.Println(lipgloss.JoinHorizontal(lipgloss.Top, border.Render(menu), statsStyle.Render(stats))) // makes a horizontal display joining two paras
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
officerStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("0000FF"))
|
officerStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("0000FF"))
|
||||||
fmt.Println(border.Render("OPP Wars - Corruption"))
|
fmt.Println(titleStyle.Render("OPP Wars - Corruption"))
|
||||||
fmt.Println(officerStyle.Render(officers))
|
fmt.Println(officerStyle.Render(officers))
|
||||||
MashEnterKey()
|
MashEnterKey()
|
||||||
ClearScreen()
|
ClearScreen()
|
||||||
fmt.Println(border.Render("OPP Wars - Corruption"))
|
fmt.Println(storyStyle.Render("OPP Wars - Corruption"))
|
||||||
fmt.Println(storyBorder.Render(intro))
|
fmt.Println(storyStyle.Render(intro))
|
||||||
fmt.Print("Enter your damned name, Constable: ")
|
fmt.Print("Enter your damned name, Constable: ")
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
prompt, _ := reader.ReadString('\n')
|
prompt, _ := reader.ReadString('\n')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue