2021-03-04 15:02:42 +01:00
|
|
|
from survival.player import Player
|
2021-03-14 17:12:11 +01:00
|
|
|
from survival.tile_layer import TileLayer
|
2021-03-04 14:07:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
class GameMap:
|
|
|
|
def __init__(self, width, height):
|
|
|
|
self.width = width
|
|
|
|
self.height = height
|
|
|
|
self.player = Player()
|
2021-03-15 13:31:25 +01:00
|
|
|
self.layers = []
|
|
|
|
self.layers.append(TileLayer(width, height))
|
2021-03-04 14:07:44 +01:00
|
|
|
|
2021-03-15 13:31:25 +01:00
|
|
|
def draw(self, camera):
|
|
|
|
for layer in self.layers:
|
|
|
|
layer.draw(camera)
|
|
|
|
self.player.draw(camera)
|
2021-03-04 14:07:44 +01:00
|
|
|
|
2021-03-15 13:31:25 +01:00
|
|
|
def update(self, camera, delta, pressed_keys):
|
2021-03-14 20:23:38 +01:00
|
|
|
self.player.update(delta, pressed_keys)
|
2021-03-15 13:31:25 +01:00
|
|
|
camera.update(self.player)
|