AI-Project/survival/__init__.py

45 lines
812 B
Python
Raw Normal View History

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
def draw_game():
game_map.draw(win)
pygame.display.update()
def update_game(pressed_keys):
game_map.update(pressed_keys)
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
clock.tick(60)
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
run = False
keys = pygame.key.get_pressed()
draw_game()
update_game(keys)