for row in self.a_map.content: for item in row: if item.x < x < item.x + item.width: if item.y < y < item.y + item.height: return item.tool_tip def camera_grab(self, x, y, width, height): "Changes the camera's view of the map." final = [] #Sets the starting variable for row in final: #Clears the old locks batch references for item in row: item.batch = None() for row in range(y, y + height): #Grabs the new part of the map final.append(self.a_map.content[row][x:x + width]) self.lock = final #Changes the lock for y,row in enumerate(self.lock): #Positions the tiles in lock and gives them a batch for x,item in enumerate(row): item.x = x * item.width + self.x_offset item.y = y * item.height + self.y_offset item.batch = self.batch def draw(self): self.batch.draw() if __name__ == "__main__": a_map = Map(10,10) serial.save_file("test.txt", a_map) test = serial.load_file("test.txt") x = Camera(test, 10, 10) print test.height
def save_file(self): self.f_working = asksaveasfilename() serial.save_file(self.f_working, self.obj_working)
if item.y < y < item.y + item.height: return item.tool_tip def camera_grab(self, x, y, width, height): "Changes the camera's view of the map." final = [] #Sets the starting variable for row in final: #Clears the old locks batch references for item in row: item.batch = None () for row in range(y, y + height): #Grabs the new part of the map final.append(self.a_map.content[row][x:x + width]) self.lock = final #Changes the lock for y, row in enumerate( self.lock ): #Positions the tiles in lock and gives them a batch for x, item in enumerate(row): item.x = x * item.width + self.x_offset item.y = y * item.height + self.y_offset item.batch = self.batch def draw(self): self.batch.draw() if __name__ == "__main__": a_map = Map(10, 10) serial.save_file("test.txt", a_map) test = serial.load_file("test.txt") x = Camera(test, 10, 10) print test.height