作业帮 > 英语 > 作业

class draw_maze(screen):NameError:name 'screen' is not defin

来源:学生作业帮 编辑:大师作文网作业帮 分类:英语作业 时间:2024/11/06 06:59:28
class draw_maze(screen):NameError:name 'screen' is not defined
'''
create on 2013\08\31
@author XGong
'''
import pygame
from pygame.locals import *
from random import randint,choice
global screen_size
screen_size=800
global r_color
r_color=(0,0,0)
class room(object):
def __init__(self,x,y):
self.x=x
self.y=y
self.wells=[True,True,True,True]
self.size=10
#self.visited=False
def visited(self):
return False
class draw_maze(screen):
room_list= [[0 for j in range(0,600)] for i in range(600)]
for i in range(0,600):
for j in range(0,600):
room_list[i]=room(i,j)
draw_room(screen,room_list[i][j],r_color)
class draw_room(screen,room,r_color):
n=0
for well in room.wells:
x=room.x
y=room.y
size=room.size
n=n+1
if well and n==1:
python.draw.line(screen,r_color,(x,y-size),(x,y))
if well and n==2:
python.draw.line(screen,r_color,(x,y),(x+size,y))
if well and n==3:
python.draw.line(screen,r_color,(x,y),(x,y+size))
if well and n==4:
python.draw.line(screen,r_color,(x-size,y),(x,y))
pygame.init()
screen=pygame.display.set_mode([screen_size,600])
pygame.display.set_caption("MAZE GAME")
screen.fill([255,255,0])
draw_maze(screen)
done=False
while done==False:
for event in pygame.event.get():
if event.type==QUIT:
done=True
pygame.display.flip()
pygame.quit()
class draw_maze(screen):NameError:name 'screen' is not defin
__init__(self,screen)