Exemplo n.º 1
0
	def populatedungeongui(self):
		self.grid = []
		so.imggrid = self.grid
		for i in range(400):
			x = dgc.imglabel(i%20,i/20,self.widget)
			x.hide()
			x.move((i%20)*20,(i/20)*20)
			x.setScaledContents(True)
			x.resize(20,20)
			self.grid.append(x)
			so.setobj(i%20,i/20,'blank')
		so.setobj(9+(so.random.random()>.5),9+(so.random.random()>.5),'goal')
Exemplo n.º 2
0
 def mousePressEvent(self, e):
     if so.grid[self.Y][self.X].canbereplaced(so.selectedobject.ID) and so.selectedobject.canreplace(self.X, self.Y):
         so.setobj(self.X, self.Y, so.selectedobject.ID)
     e.accept()
Exemplo n.º 3
0
	def canreplace(self,x,y):
		if (x in [0,19]) == (y in [0,19]): return False
		if so.entrancecoords: so.setobj(so.entrancecoords[0],so.entrancecoords[1],'blank')
		so.entrancecoords = (x,y)
		return True