So first of all apologies for bad code style, this is my first big project(a final for my python class). I'm stuck on the loop setup I need to move from the "main menu" displaymenu function to the movemenu function, as it runs right now when selecting the choice A from displaymenu nothing happens, the choice b and c work just fine. My guess is its a problem with how I designed the loops, and breaking/moving from one loop to another.
As far as the actual movement goes, I took a pretty good stab at it, but making the menus work is critical to even being able to test the movement, so thats where I am in that regard.
Any input or constructive criticism is very appreciated. Thank you
#map movement functions---------------------------------------------------------
def mapFunc(x,y):
if x == 0:
if y == 0:
print("Sh*ts Swampy yo")
elif y == 1:
print("Sh*ts Sandy broski")
elif y == 2:
print("trees everywhere bro")
else:
print("how the f**k did you get here")
elif x == 1:
if y == 0:
print("Sh*ts Swampy yo")
elif y == 1:
print("Sh**s Sandy broski")
elif y == 2:
print("trees everywhere bro")
else:
print("how the f**k did you get here")
elif x == 2:
if y == 0:
print("S**s Swampy yo")
elif y == 1:
print("Sh*s Sandy broski")
elif y == 2:
print("trees everywhere bruh")
else:
print("how the f**k did you get here")
def displayMenu():
choice = None
choice = input("""
Choose from the following options:
A.)Map Movement
B.) Display Inventory and Stats
C.) Configure Power Treads
""").upper()
if choice == 'A':
moveMenu()
completed = True
elif choice == 'B':
displayStats(player)
elif choice == 'C':
askPowerTread()
else:
choice not in ['A','B','C']
print("Invalid choice.")
def moveMenu():
choice = None
validMapMovement = False
#while choice not in ('A', 'B', 'C', 'D'):
while not validMapMovement:
choice = input
("""
Choose a direction:
A.) North
B.) South
C.) East
D.) West
""").upper()
if choice == 'A':
if playerY (+1) >= 0:
playerY -= 1
mapFunc(playerX, playerY)
validMapMovement = True
else:
print("Invalid Choice")
elif choice == 'B':
if playerY +1 <= 2:
playerY += 1
mapFunc(playerX, playerY)
validMapMovement = True
else:
print("Invalid Choice")
elif choice == 'C':
if playerX +1 <= 2:
playerX += 1
mapFunc(playerX, playerY)
validMapMovement = True
else:
print("Invalid Choice")
elif choice == 'D':
if playerY -1 >= 0:
playerX -= 1
mapFunc(playerX, playerY)
validMapMovement = True
else:
print("Invalid Choice")
else:
choice not in ('A', 'B', 'C', 'D')
print("Invalid Choice")
roll()
then the file with my main in it
#ExampleQuest, v5.5
from ExampleQuestFunctions import *
import random #rolls
import time #sleep
# Introduction #
#Main Loop()---------------------------------------------------------------------------
player = ["",20,5,10,3,7,0]
playerInventory = []
playerX = 0
playerY = 0
def mapPhase():
completed = False
while not completed:
displayMenu()
#Battle Loop()---------------------
def battlePhase():
#Instance Variables
playerTurn = True
completed = False
playAgain = True
while playAgain:
#Create the enemy pool, and generate a random enemy
pool = createEnemyPool()
enemy = random.choice(pool)
#Start the battle
player = battle(player, enemy, playerTurn)
#Continue Adventure
if getString("Would you like to continue your adventure?").upper() not in ['Y','YES']:
playAgain = False
else:
playAgain = False
inventoryUpdate()
#-----------------------
def main():
mapPhase()
#Run it!
main()