from generators import * import time W = 30 H = 20 MULT = 50 SIZE = (MULT*W, MULT*H) pygame.init() screen = pygame.display.set_mode(SIZE) tilemap = Tilemap(Tileset("sprites/TIles/1 Tiles/FieldsTile_38.png", mult=MULT), mult=MULT, size=(W, H)) targimage = pygame.image.load("sprites/X.png").convert_alpha() targimage = pygame.transform.scale(targimage, (MULT, MULT)) trashcans = trashcanGenerator(MULT) houses = householdGenerator(MULT) garbagetruck = Garbagetruck(MULT).setHouses(houses).setTrashcans(trashcans) # print("Kolejność danych do drzewa:") # print("Pora roku - Pora dnia - Typ śmieci - Zapełnienie kosza - Zapełnienie śmieciarki - Zapłacone - Ostatnio zabrane " # "- Pogoda") running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False garbagetruck.setTarget() garbagetruck.executeMovement() screen.fill((0, 0, 0)) tilemap.render(MULT) screen.blit(tilemap.image, tilemap.rect) for i in trashcans: screen.blit(i.getImage(), i.printme()) for h in houses: screen.blit(h.getImage(), h.printme()) bruh = garbagetruck.target.getPosition() bruhlist = [i*MULT for i in bruh] screen.blit(targimage, bruhlist) screen.blit(garbagetruck.getImage(), garbagetruck.printme()) pygame.display.update() garbagetruck.scanTile() state = garbagetruck.getState() while garbagetruck.getAnalising(): garbagetruck.pickTrash() if not garbagetruck.movesequence: moves = garbagetruck.graphsearch() garbagetruck.setMovesequence(moves) if state: if state.getFinal(): # print([trash.getTtype() for trash in state.getGarbage().getContent()]) garbagetruck.switchAnalising() garbagetruck.getState().switchFinal() elif not garbagetruck.movesequence: garbagetruck.randomTarget() time.sleep(0.5) pygame.quit()