38 lines
800 B
Python
38 lines
800 B
Python
import pygame as pg
|
|
import sys
|
|
import numpy as np
|
|
from tile import Tile
|
|
from config import *
|
|
|
|
done = False
|
|
|
|
clock = pg.time.Clock()
|
|
pg.display.set_caption('Intelligent Tractor')
|
|
tiles = []
|
|
|
|
for y in range(0, 7):
|
|
for x in range(0, 7):
|
|
t = Tile(background[x][y], objects[x][y], x, y)
|
|
tiles.append(t)
|
|
|
|
|
|
def display_background():
|
|
for tile in tiles:
|
|
screen.blit(bg_textures[tile.ground], (tile.x * tile_size, tile.y * tile_size))
|
|
|
|
|
|
def display_objects():
|
|
for tile in tiles:
|
|
screen.blit(ob_textures[tile.object], (tile.x * tile_size, tile.y * tile_size))
|
|
pg.display.flip()
|
|
|
|
|
|
while not done:
|
|
for event in pg.event.get():
|
|
if event.type == pg.QUIT:
|
|
done = True
|
|
display_background()
|
|
display_objects()
|
|
clock.tick(60)
|
|
|
|
pg.quit() |