50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
import pygame
|
|
|
|
from src.world import World
|
|
from src.tractor import Tractor
|
|
from src.settings import Settings
|
|
|
|
|
|
def draw_line(screen: pygame.display, settings):
|
|
for line in range(0, 11):
|
|
pygame.draw.line(screen, (255, 255, 255), (0, line * settings.tile_size),
|
|
(settings.screen_width, line*settings.tile_size))
|
|
pygame.draw.line(screen, (255, 255, 255), (line * settings.tile_size, 0),
|
|
(line * settings.tile_size, settings.screen_height))
|
|
|
|
|
|
# TODO: add Sprite to every class and store Tile objects as Sprite group
|
|
|
|
def main():
|
|
pygame.init()
|
|
|
|
settings = Settings()
|
|
world = World(settings)
|
|
tractor = Tractor("Spalinowy", "Nawóz 1", settings)
|
|
|
|
screen = pygame.display.set_mode((settings.screen_width, settings.screen_height))
|
|
pygame.display.set_caption('TRAKTOHOLIK')
|
|
|
|
background_image = pygame.image.load('assets/images/sky.png')
|
|
background_image = pygame.transform.scale(background_image, (settings.screen_width, settings.screen_height))
|
|
|
|
run = True
|
|
|
|
while run:
|
|
screen.blit(background_image, (0, 0))
|
|
world.draw(screen)
|
|
draw_line(screen, settings)
|
|
screen.blit(tractor.image, (6*settings.tile_size, 5*settings.tile_size))
|
|
|
|
for event in pygame.event.get():
|
|
if event.type == pygame.QUIT:
|
|
run = False
|
|
|
|
pygame.display.update()
|
|
|
|
pygame.quit()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|