2021-03-04 14:07:44 +01:00
|
|
|
import pygame
|
|
|
|
|
2021-03-04 15:02:42 +01:00
|
|
|
from survival.game_map import GameMap
|
2021-03-04 14:07:44 +01:00
|
|
|
|
|
|
|
window_width = 1280
|
|
|
|
window_height = 720
|
|
|
|
|
|
|
|
|
2021-03-14 20:23:38 +01:00
|
|
|
def draw_game(delta):
|
|
|
|
game_map.draw(delta, win)
|
2021-03-04 14:07:44 +01:00
|
|
|
pygame.display.update()
|
|
|
|
|
|
|
|
|
2021-03-14 20:23:38 +01:00
|
|
|
def update_game(delta, pressed_keys):
|
|
|
|
game_map.update(delta, pressed_keys)
|
2021-03-04 14:07:44 +01:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
pygame.init()
|
|
|
|
|
|
|
|
win = pygame.display.set_mode((window_width, window_height))
|
|
|
|
pygame.display.set_caption("AI Project")
|
|
|
|
|
|
|
|
clock = pygame.time.Clock()
|
|
|
|
|
|
|
|
game_map = GameMap(int(window_width/32), int(window_height/32) + 1)
|
|
|
|
|
|
|
|
run = True
|
|
|
|
|
|
|
|
while run:
|
|
|
|
# Set the framerate
|
2021-03-14 20:23:38 +01:00
|
|
|
ms = clock.tick(60)
|
2021-03-04 14:07:44 +01:00
|
|
|
|
|
|
|
events = pygame.event.get()
|
|
|
|
|
|
|
|
for event in events:
|
|
|
|
if event.type == pygame.QUIT:
|
|
|
|
run = False
|
|
|
|
|
|
|
|
keys = pygame.key.get_pressed()
|
|
|
|
|
2021-03-14 20:23:38 +01:00
|
|
|
draw_game(ms)
|
|
|
|
update_game(ms, keys)
|