I've begun to focus more on learning programming, rather than learning enough programming to attempt some of my projects.
step 1. learn to code in python and unity
step 2. build some small games implementing or at least attempting to iterate my ideas.
step 3. get better at coding
step 4. start building prototypes of my bigger ideas and producing practice prototypes - various website ideas including a robot game engine and space simulation social network, a 3rd person shooter mixed with a streets of rage-style platform beatemup structure to build an action-adventure game based on a story I'm writing, various other ideas.
step 5. get better at coding...
I am discovering the define method.
I have a problem with my program:
"I'm trying to figure out def methods: My program is not working."
#this is the start of my program:
def game():
again = ""
buy = ""
wallet = 30
attributes = {"Dexterity": 30, "Wisdom":30, "Health":30, "Strength":30}
def start ():
print (attributes)
while again != "n":
if attributes == "":
print("goodbye!")
else: #program continues on for awhile, cut off here for brevity
#this is the end of my program
elif choice == 4:
#sell an attribute
sellAll = input ("which attribute would you like to sell all of?:")
if sellAll in attributes:
wallet += attributes[sellAll]
del attributes[sellAll]
print ("You have ", wallet, " dollars left"); print (attributes)
else: print ("that is not a legit attribute!")
again = input ("play again y/n")
if again == "y": start ()
if wallet <= 0: print ("you can't play anymore"); break
replay = input("Are you tough enough to play? y/n")
if replay == "y": game(), start ()
I clearly am trying to use define method when I don't fully understand how it works.
Originally the game worked, when I just used one define method - "def game ()"
But I started trying to use two to solve the problem that the game wasn't returning to the start of the program within the loop.
That's when I ran into problems.
↧