Beispiel #1
0
 def __init__(self, game, save_file = None):
     messenger.Messenger.gamescreens.append(self)
     self.game = game
     self.save_file = save_file
     self.map = serial.load_file("resources/map/default_map")
     self.map.objects["player"] = Player(self.map.objects["player_start"][0],
                                         self.map.objects["player_start"][1],
                                         self)
     self.toolbar = toolbar.Toolbar()
     self.map.objects.setdefault("npcs",[]).append(Corinth(100,100,self)) #testing NPC
     self.camera = tile.Camera(self.map, CAMERA_WIDTH, CAMERA_HEIGHT, 0, 128)
     self.lambdas = []
     self.keys = []
     self.update_start()
     if save_file:
         self.load_save(save_file)
Beispiel #2
0
 def __init__(self, game, save_file=None):
     messenger.Messenger.gamescreens.append(self)
     self.game = game
     self.save_file = save_file
     self.map = serial.load_file("resources/map/default_map")
     self.map.objects["player"] = Player(
         self.map.objects["player_start"][0],
         self.map.objects["player_start"][1], self)
     self.toolbar = toolbar.Toolbar()
     self.map.objects.setdefault("npcs",
                                 []).append(Corinth(100, 100,
                                                    self))  #testing NPC
     self.camera = tile.Camera(self.map, CAMERA_WIDTH, CAMERA_HEIGHT, 0,
                               128)
     self.lambdas = []
     self.keys = []
     self.update_start()
     if save_file:
         self.load_save(save_file)
Beispiel #3
0
        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
    
Beispiel #4
0
                    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
Beispiel #5
0
 def load_file(self):
     try:
         self.f_working = askopenfilename()
         self.obj_working = serial.load_file(self.f_working)
     except IOError:
         print "File not found."
Beispiel #6
0
 def load_file(self):
     try:
         self.f_working = askopenfilename()
         self.obj_working = serial.load_file(self.f_working)
     except IOError:
         print "File not found."