Massive updates to the stormgames library.
This commit is contained in:
parent
4db7cfeb9e
commit
911b37085e
5
files/instructions.txt
Normal file
5
files/instructions.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
You are given a scrambled list of numbers from 1 to 9. Press the number you want to flip from, and that number, plus all the numbers to the right of it will reverse.
|
||||||
|
you can also navigate by using the up, down, left, and right arrows. When you are on the number you want, press enter and the flip will take place.
|
||||||
|
the object of the game is to get the numbers in the right order, from 1 through 9.
|
||||||
|
1 2 3 4 5 6 7 8 9
|
||||||
|
in as few tries as possible, as quickly as you can.
|
@ -90,43 +90,36 @@ def display_message(info):
|
|||||||
time.sleep(0.001)
|
time.sleep(0.001)
|
||||||
|
|
||||||
def instructions():
|
def instructions():
|
||||||
info = (
|
# Read in the instructions file
|
||||||
"Welcome to " + gameName + ": brought to you by Storm Dragon. Use the up and down arrows to navigate these instructions.",\
|
try:
|
||||||
"The object of the game is to arrange the random string of numbers so they read one through nine in as few tries as possible.",\
|
with open('files/instructions.txt', 'r') as f:
|
||||||
"You can use the up or left arrow to move back in the string, and the down or right arrow to move forward, or close to the end of the string of numbers.",\
|
info = f.readlines()
|
||||||
"you can also jump directly to the number you want by pressing it on your keyboard. If you want to go to the number 8 in the string, just press 8.",\
|
except:
|
||||||
"When you are on the number you want, press the enter key and that number, plus all the numbers to the end of the string, will be reversed.",\
|
info = ["Instructions file is missing."]
|
||||||
"For example, if you have the string of numbers 1 2 3 4 5 6 9 8 7, pressing enter while on the number 9 will reverse 9 8 7, making the string 1 2 3 4 5 6 7 8 9 and you will win the game.",\
|
display_text(info)
|
||||||
"If you need to her the string of numbers from your current position, press the spacebar.",\
|
|
||||||
"Have fun, and good luck!",\
|
|
||||||
"Press escape or enter to return to the game menu.")
|
|
||||||
i = 0
|
|
||||||
speak(info[i])
|
|
||||||
while True:
|
|
||||||
event = pygame.event.wait()
|
|
||||||
if event.type == pygame.KEYDOWN:
|
|
||||||
if event.key == pygame.K_ESCAPE or event.key == pygame.K_RETURN: return
|
|
||||||
if event.key == pygame.K_DOWN and i < len(info) - 1: i = i + 1
|
|
||||||
if event.key == pygame.K_UP and i > 0: i = i - 1
|
|
||||||
speak(info[i])
|
|
||||||
event = pygame.event.clear()
|
|
||||||
time.sleep(0.001)
|
|
||||||
|
|
||||||
def credits():
|
def credits():
|
||||||
info = (
|
info = [
|
||||||
gameName + ": brought to you by Storm Dragon",\
|
gameName + ": brought to you by Storm Dragon",\
|
||||||
"Billy Wolfe, designer and coder.",\
|
"Billy Wolfe, designer and coder.",\
|
||||||
"https://social.wolfe.casa/storm",\
|
"https://social.wolfe.casa/storm"]
|
||||||
"Press escape or enter to return to the game menu.")
|
display_text(info)
|
||||||
|
|
||||||
|
def display_text(text):
|
||||||
i = 0
|
i = 0
|
||||||
speak(info[i])
|
text.insert(0, "Press space to read the whole text. Use up and down arrows to navigate the text line by line. Press enter or escape when you are done reading.")
|
||||||
|
text.append("End of text.")
|
||||||
|
speak(text[i])
|
||||||
while True:
|
while True:
|
||||||
event = pygame.event.wait()
|
event = pygame.event.wait()
|
||||||
if event.type == pygame.KEYDOWN:
|
if event.type == pygame.KEYDOWN:
|
||||||
if event.key == pygame.K_ESCAPE or event.key == pygame.K_RETURN: return
|
if event.key == pygame.K_ESCAPE or event.key == pygame.K_RETURN: return
|
||||||
if event.key == pygame.K_DOWN and i < len(info) - 1: i = i + 1
|
if event.key == pygame.K_DOWN and i < len(text) - 1: i = i + 1
|
||||||
if event.key == pygame.K_UP and i > 0: i = i - 1
|
if event.key == pygame.K_UP and i > 0: i = i - 1
|
||||||
speak(info[i])
|
if event.key == pygame.K_SPACE:
|
||||||
|
speak(''.join(text[1:]))
|
||||||
|
else:
|
||||||
|
speak(text[i])
|
||||||
event = pygame.event.clear()
|
event = pygame.event.clear()
|
||||||
time.sleep(0.001)
|
time.sleep(0.001)
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from storm_games import *
|
from libstorm_games import *
|
||||||
|
|
||||||
# Initial variable settings
|
# Initial variable settings
|
||||||
mode = "menu"
|
mode = "menu"
|
||||||
|
Loading…
Reference in New Issue
Block a user