AI_PROJECT/App.py

51 lines
1.1 KiB
Python
Raw Normal View History

import pygame
import Colors
import Tractor
import Pole
import time
import displayControler as dCon
import Image
2024-03-23 21:00:08 +01:00
import Osprzet
pygame.init()
screen = pygame.display.set_mode((dCon.getScreenWidth(), dCon.getScreenHeihgt()))
image_loader=Image.Image()
image_loader.load_images()
pole=Pole.Pole(screen,image_loader)
2024-03-23 21:00:08 +01:00
pole.draw_grid() #musi byc tutaj wywołane ponieważ inicjalizuje sloty do slownika
2024-03-23 21:00:08 +01:00
#Tractor creation
traktor_slot = pole.get_slot_from_cord((0, 0))
traktor = Tractor.Tractor(traktor_slot, screen, Osprzet.plug)
2024-03-23 21:00:08 +01:00
def init_demo(): #Demo purpose
traktor.draw_tractor()
time.sleep(2)
pole.randomize_colors()
traktor.draw_tractor()
while True:
time.sleep(0.5)
demo_move()
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
def init(demo):
pygame.display.update()
if(demo==True):
init_demo()
#TODO: Implement
def demo_move():
2024-03-23 21:00:08 +01:00
current_slot = traktor.slot
if current_slot:
current_slot.redraw_image() # Przerysowanie obrazu dla aktualnego slotu
traktor.random_move(pole)