Way to get money
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
Major update!
|
Major update!
|
||||||
Added saving to the web version!
|
Added saving to the web version!
|
||||||
Added happiness level and fullness level
|
Added happiness level and fullness level
|
||||||
|
Added method to get money
|
||||||
6
game.py
6
game.py
@@ -1,6 +1,6 @@
|
|||||||
from data.cat import Cat
|
from data.cat import Cat
|
||||||
from systems.ui import clear, title
|
from systems.ui import clear, title
|
||||||
from systems.world import shelter, house, shop
|
from systems.world import shelter, house, shop, work
|
||||||
import systems.ui as ui
|
import systems.ui as ui
|
||||||
import data.save
|
import data.save
|
||||||
import data.text
|
import data.text
|
||||||
@@ -86,12 +86,14 @@ class Game:
|
|||||||
while True:
|
while True:
|
||||||
match ui.select(
|
match ui.select(
|
||||||
"Please choose an option",
|
"Please choose an option",
|
||||||
["Go to your house", "Go to the shop", "Options"],
|
["Go to your house", "Go to the shop", "Go to work", "Options"],
|
||||||
):
|
):
|
||||||
case "Go to your house":
|
case "Go to your house":
|
||||||
house(self.cat)
|
house(self.cat)
|
||||||
case "Go to the shop":
|
case "Go to the shop":
|
||||||
shop(self.cat)
|
shop(self.cat)
|
||||||
|
case "Go to work":
|
||||||
|
work(self.cat)
|
||||||
case "Options":
|
case "Options":
|
||||||
if self.options_menu():
|
if self.options_menu():
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import re
|
|||||||
import data.text
|
import data.text
|
||||||
import random
|
import random
|
||||||
import systems.items
|
import systems.items
|
||||||
|
import time
|
||||||
|
import string
|
||||||
|
|
||||||
|
|
||||||
def check_cat_name(name):
|
def check_cat_name(name):
|
||||||
@@ -225,3 +227,49 @@ def house(cat: Cat):
|
|||||||
storage(cat)
|
storage(cat)
|
||||||
case "Leave your house":
|
case "Leave your house":
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
def work(cat: Cat):
|
||||||
|
length = 2
|
||||||
|
total_earned = 0
|
||||||
|
lost = False
|
||||||
|
print("Welcome to work!")
|
||||||
|
print("The rules:")
|
||||||
|
print(
|
||||||
|
"Each round, a string of letters will appear, when it says go, type them from memory. If you miss one, you lose, each round gets more money."
|
||||||
|
)
|
||||||
|
if not ui.confirm("Would you like to start?"):
|
||||||
|
return
|
||||||
|
for i in range(3, 0, -1):
|
||||||
|
print(i)
|
||||||
|
time.sleep(1)
|
||||||
|
ui.clear()
|
||||||
|
print("Start!")
|
||||||
|
while not lost:
|
||||||
|
seconds = 1 + (length * 0.5)
|
||||||
|
letters = random.choices(string.ascii_lowercase, k=length)
|
||||||
|
print(f"Round {len(letters)-1}")
|
||||||
|
print("Memorize:", " ".join(letters))
|
||||||
|
for i in range(round(seconds), 0, -1):
|
||||||
|
print(i)
|
||||||
|
time.sleep(1)
|
||||||
|
ui.clear()
|
||||||
|
print(f"Round {len(letters)-1}")
|
||||||
|
print("Type!")
|
||||||
|
pos = 0
|
||||||
|
for i in letters:
|
||||||
|
key = ui.getch()
|
||||||
|
print(key, end=" ", flush=True)
|
||||||
|
if key != letters[pos]:
|
||||||
|
print(f"\nThe correct key was: {letters[pos]}")
|
||||||
|
lost = True
|
||||||
|
break
|
||||||
|
pos += 1
|
||||||
|
if not lost:
|
||||||
|
total_earned += 3
|
||||||
|
print("\nCorrect!")
|
||||||
|
time.sleep(1)
|
||||||
|
ui.clear()
|
||||||
|
length += 1
|
||||||
|
cat.money += total_earned
|
||||||
|
print(f"Game finished! You earned ${total_earned}, you now have ${cat.money}!")
|
||||||
|
|||||||
Reference in New Issue
Block a user