So, I am developing this game where the graphics is made entirely of text.
This prototype looks right but there are some errors in the program.
If anyone has any solutions to the problem please, tell me.
global tiles
tiles = ["=","#"," "]
st1 = [1,1,1,1,1]
global pcx
global pcy
global lcx
global lcy
pcx = 3
pcy = 3
lcx = 3
lcy = 3
#makes 1 charecter on the screen
def j1t(ps):
ltr = ""
if pcx == lcx and lcy == pcy: # error "UnboundLocalError: local variable 'pcx' referenced before assignment""
ltr = "@"
else:
ltr = tiles[ps[pcx]]
if pcx == 5:
pcx -= 4
else:
pcx += 1
return ltr
print(j1t(st1)) # error "line 25, in <module> print(j1t(st1))"