Beispiel #1
0
 def render(self):
     """Render the whole array of tiles and entities."""
     for i, row in enumerate(self._tiles):
         for j, tile in enumerate(row):
             tile.render(iso_to_screen(Point(i, j)))
             if self.knight.pos.round() == Point(i, j):
                 self.knight.render()
Beispiel #2
0
 def render(self, mouse):
     self.level.render()
     self.highlight.render(iso_to_screen(screen_to_iso(mouse.pos)))
     self.restart.render(Point((SCREEN.center * 2).x, 0))
     self.levels.render(Point(0, 0))
     if self.level.win():
         self.win.render(SCREEN.center)
Beispiel #3
0
 def render(self, mouse):
     self.level.render()
     self.highlight.render(iso_to_screen(screen_to_iso(mouse.pos)))
     self.restart.render(Point((SCREEN.center * 2).x, 0))
     self.levels.render(Point(0, 0))
     if self.level.win():
         self.win.render(SCREEN.center)
Beispiel #4
0
 def logic(self):
     if self.move_counter:
         self.move_counter -= 1
         self.pos += ((self.target - self.prev) * (1.0 / TILE_STEPS))
         if not self.move_counter:
             self.level()._tiles[self.target.x][self.target.y].on_enter(self)
     pos = iso_to_screen(self.pos)
     SCREEN.camera = SCREEN.center - pos
Beispiel #5
0
 def __init__(self, tileset, filename):
     # tileset
     self.tileset = tileset
     # layer data
     with open('resources/levels/' + filename) as f:
         lines = f.readlines()
     self._tiles = [[copy(self.tileset[int(tile)])
                     for tile in row.strip(' \r\n,').split(',')]
                    for row in lines]
     # find start point
     for i, row in enumerate(lines):
         for j, tile in enumerate(row.strip(' \r\n,').split(',')):
             if tile == '0':
                 start_point = Point(i, j)
     # player
     self.knight = Knight(self, start_point)
     SCREEN.camera = SCREEN.center - iso_to_screen(start_point)
Beispiel #6
0
 def render(self):
     """Renders the knight to the screen at his current location."""
     self._renderable.render(iso_to_screen(self.pos))