David Greydanus
David Greydanus

Reputation: 2567

What is wrong with this python game?

A friend of mine has been making a text based game in python.The game seems to be going well so far, but we keep getting an error saying "if gamemap == [0,0]: NameError: global name 'gamemap' is not defined".Thank you so much for your help.

Here is the code. https://docs.google.com/document/d/1m0Ue7SDg5kZCSYGS7XqqGEH_J4RNtX_kwhPD9gKizxc/edit

Upvotes: 0

Views: 87

Answers (1)

Joohwan
Joohwan

Reputation: 2512

I think you need to declare the gamemap variable global before you call it in each of your functions:

def func():
    global gamemap
    # rest of your code goes here

Upvotes: 3

Related Questions