Merge pull request 'Movement gotowy' (#4) from premain into main
Reviewed-on: #4
@ -1,16 +1,21 @@
|
|||||||
|
import math
|
||||||
|
import random
|
||||||
|
|
||||||
import pygame
|
import pygame
|
||||||
from classes.Household import *
|
from classes.Household import *
|
||||||
from classes.Trashcan import *
|
from classes.Node import *
|
||||||
|
from classes.Trashcan import Trashcan
|
||||||
|
|
||||||
|
|
||||||
class Garbagetruck:
|
class Garbagetruck:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, mult):
|
||||||
|
self.mult = mult
|
||||||
self.capacity: int = 20
|
self.capacity: int = 20
|
||||||
self.trash: list = []
|
self.trash: list = []
|
||||||
self.trashweight: int = 0
|
self.trashweight: int = 0
|
||||||
self.image = pygame.image.load("sprites/garbage_truck.png").convert_alpha()
|
self.image = pygame.image.load("sprites/smieciara.png").convert_alpha()
|
||||||
self.image = pygame.transform.scale(self.image, (32, 32))
|
self.image = pygame.transform.scale(self.image, (mult, mult))
|
||||||
self.position = [3, 3]
|
self.position = [3, 3]
|
||||||
self.houses: list = []
|
self.houses: list = []
|
||||||
self.trashcans: list = []
|
self.trashcans: list = []
|
||||||
@ -24,7 +29,34 @@ class Garbagetruck:
|
|||||||
self.scanner = None
|
self.scanner = None
|
||||||
self.planner = None
|
self.planner = None
|
||||||
self.driver = None
|
self.driver = None
|
||||||
|
self.orientation = 3 # Niech numery będą tak: N - 0, W - 1, S - 2, E - 3 -- po prostu odwrotnie do zegara
|
||||||
self.runningtime = 0
|
self.runningtime = 0
|
||||||
|
self.movesequence = []
|
||||||
|
self.target = None
|
||||||
|
|
||||||
|
def getState(self):
|
||||||
|
return self.state
|
||||||
|
|
||||||
|
def setMovesequence(self, movesequence):
|
||||||
|
self.movesequence = movesequence
|
||||||
|
return self
|
||||||
|
|
||||||
|
def setTarget(self):
|
||||||
|
for place in self.houses:
|
||||||
|
if place.getFinal():
|
||||||
|
self.target = place
|
||||||
|
return
|
||||||
|
for place in self.trashcans:
|
||||||
|
if place.getFinal():
|
||||||
|
self.target = place
|
||||||
|
return
|
||||||
|
|
||||||
|
def getOrientation(self):
|
||||||
|
return self.orientation
|
||||||
|
|
||||||
|
def setOrientation(self, orientation):
|
||||||
|
self.orientation = orientation % 4
|
||||||
|
return self
|
||||||
|
|
||||||
def getRunningtime(self):
|
def getRunningtime(self):
|
||||||
return self.runningtime
|
return self.runningtime
|
||||||
@ -91,7 +123,8 @@ class Garbagetruck:
|
|||||||
def modPosiotion(self, modX, modY):
|
def modPosiotion(self, modX, modY):
|
||||||
x = self.getPosition()[0] + modX
|
x = self.getPosition()[0] + modX
|
||||||
y = self.getPosition()[1] + modY
|
y = self.getPosition()[1] + modY
|
||||||
self.setPosition([x, y])
|
position = [x, y]
|
||||||
|
self.setPosition(position)
|
||||||
|
|
||||||
def getRoute(self):
|
def getRoute(self):
|
||||||
return self.route
|
return self.route
|
||||||
@ -124,24 +157,157 @@ class Garbagetruck:
|
|||||||
dist = abs(lok1[0] - lok2[0]) + abs(lok1[1] - lok2[1])
|
dist = abs(lok1[0] - lok2[0]) + abs(lok1[1] - lok2[1])
|
||||||
return dist
|
return dist
|
||||||
|
|
||||||
|
def selfdistance(self, target):
|
||||||
|
if isinstance(target, (Trashcan, Household)):
|
||||||
|
lok = target.getPosition()
|
||||||
|
own = self.getPosition()
|
||||||
|
|
||||||
|
dist = abs(lok[0] - own[0]) + abs(lok[1] - own[1])
|
||||||
|
return dist
|
||||||
|
return math.inf
|
||||||
|
|
||||||
def scanTile(self):
|
def scanTile(self):
|
||||||
self.state = None
|
self.state = None
|
||||||
temp = self.houses[:]
|
temp = self.houses[:]
|
||||||
temp.append(self.trashcans[:])
|
temp.extend(self.trashcans[:])
|
||||||
for loc in temp:
|
for loc in temp:
|
||||||
if tuple(self.position) == loc.getPosition():
|
if tuple(self.position) == loc.getPosition():
|
||||||
self.state = loc
|
self.state = loc
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
self.state = False
|
||||||
|
|
||||||
def printme(self):
|
def printme(self):
|
||||||
x, y = self.getPosition()
|
x, y = self.getPosition()
|
||||||
return 32*x, 32*y
|
return self.mult*x, self.mult*y
|
||||||
|
|
||||||
def throwGarbage(self, trash):
|
def throwGarbage(self, trash):
|
||||||
if self.segregation[trash.getTtype()] == self.state.getTrashtype():
|
if self.segregation[trash.getTtype()] == self.state.getTrashtype():
|
||||||
self.addTrashweight(trash.getWeight * (-1))
|
self.addTrashweight(trash.getWeight * (-1))
|
||||||
self.trash.remove(trash)
|
self.trash.remove(trash)
|
||||||
|
|
||||||
|
def rotateImage(self, arg):
|
||||||
|
self.image = pygame.transform.rotate(self.image, 90*arg)
|
||||||
|
|
||||||
|
def rotateLeft(self):
|
||||||
|
self.setOrientation(self.getOrientation()+1)
|
||||||
|
self.rotateImage(1)
|
||||||
|
|
||||||
|
def rotateRight(self):
|
||||||
|
self.setOrientation(self.getOrientation()-1)
|
||||||
|
self.rotateImage(-1)
|
||||||
|
|
||||||
|
def moveForward(self):
|
||||||
|
ort = self.orientation
|
||||||
|
x, y = self.getPosition()
|
||||||
|
stepX = 0
|
||||||
|
stepY = 0
|
||||||
|
if ort == 0 and y != 0:
|
||||||
|
stepY = -1
|
||||||
|
elif ort == 1 and x != 0:
|
||||||
|
stepX = -1
|
||||||
|
elif ort == 2 and y != 20:
|
||||||
|
stepY = 1
|
||||||
|
elif ort == 3 and x != 30:
|
||||||
|
stepX = 1
|
||||||
|
self.modPosiotion(stepX, stepY)
|
||||||
|
|
||||||
|
def graphsearch(self):
|
||||||
|
def succ(elem):
|
||||||
|
def virtRotateLeft(state):
|
||||||
|
ort = (state[-1] + 1) % 4
|
||||||
|
result = state[:]
|
||||||
|
result[-1] = ort
|
||||||
|
return result
|
||||||
|
|
||||||
|
def virtRotateRight(state):
|
||||||
|
ort = (state[-1] - 1) % 4
|
||||||
|
result = state[:]
|
||||||
|
result[-1] = ort
|
||||||
|
return result
|
||||||
|
|
||||||
|
def virtMoveForward(state):
|
||||||
|
ort = state[-1]
|
||||||
|
x, y = state[0], state[1]
|
||||||
|
stepX, stepY = 0, 0
|
||||||
|
if ort == 0 and y != 0:
|
||||||
|
stepY = -1
|
||||||
|
elif ort == 1 and x != 0:
|
||||||
|
stepX = -1
|
||||||
|
elif ort == 2 and y != 20:
|
||||||
|
stepY = 1
|
||||||
|
elif ort == 3 and x != 30:
|
||||||
|
stepX = 1
|
||||||
|
x += stepX
|
||||||
|
y += stepY
|
||||||
|
result = [x, y, ort]
|
||||||
|
return result
|
||||||
|
|
||||||
|
op = elem.getState()
|
||||||
|
forward = {"result": virtMoveForward(op), "action": "F"}
|
||||||
|
left = {"result": virtRotateLeft(op), "action": "L"}
|
||||||
|
right = {"result": virtRotateRight(op), "action": "R"}
|
||||||
|
# print("got children")
|
||||||
|
return [forward, left, right]
|
||||||
|
|
||||||
|
fringe = []
|
||||||
|
explored = []
|
||||||
|
target = self.target.getPosition()
|
||||||
|
temp = self.getPosition()[:]
|
||||||
|
temp.append(self.getOrientation())
|
||||||
|
initial = Node(temp)
|
||||||
|
fringe.append(initial)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
fringPos = [item.getState() for item in fringe]
|
||||||
|
explPos = [item.getState() for item in explored]
|
||||||
|
if not fringe:
|
||||||
|
return False
|
||||||
|
|
||||||
|
elem = fringe.pop(0)
|
||||||
|
virtPos = elem.getState()[:-1]
|
||||||
|
dist = abs(virtPos[0]-target[0]) + abs(virtPos[1]-target[1])
|
||||||
|
if dist == 0:
|
||||||
|
def findWay(node):
|
||||||
|
temp = node
|
||||||
|
movelist = []
|
||||||
|
while temp:
|
||||||
|
movelist.append(temp.getAction())
|
||||||
|
temp = temp.getParent()
|
||||||
|
return movelist
|
||||||
|
|
||||||
|
lista = findWay(elem)
|
||||||
|
result = lista[::-1]
|
||||||
|
result.pop(0)
|
||||||
|
return result
|
||||||
|
|
||||||
|
explored.append(elem)
|
||||||
|
suc = succ(elem)
|
||||||
|
for wynik in suc:
|
||||||
|
if wynik['result'] not in fringPos and wynik['result'] not in explPos:
|
||||||
|
x = Node(wynik["result"])
|
||||||
|
x.setParent(elem)
|
||||||
|
x.setAction(wynik["action"])
|
||||||
|
fringe.append(x)
|
||||||
|
|
||||||
|
def executeMovement(self):
|
||||||
|
element = self.movesequence.pop(0) if self.movesequence else ""
|
||||||
|
if element == "L":
|
||||||
|
self.rotateLeft()
|
||||||
|
elif element == "R":
|
||||||
|
self.rotateRight()
|
||||||
|
elif element == "F":
|
||||||
|
self.moveForward()
|
||||||
|
|
||||||
|
def randomTarget(self):
|
||||||
|
wybor1 = random.choice([1,2])
|
||||||
|
if wybor1 == 1:
|
||||||
|
wybor2 = random.choice(self.houses)
|
||||||
|
else:
|
||||||
|
wybor2 = random.choice(self.trashcans)
|
||||||
|
wybor2.switchFinal()
|
||||||
|
# print(wybor2)
|
||||||
|
|
||||||
def classifyTrash(self):
|
def classifyTrash(self):
|
||||||
pass
|
pass
|
||||||
# Tutaj jest plan żeby dopiero napisać funkcję jak już będzie klasyfikator
|
# Tutaj jest plan żeby dopiero napisać funkcję jak już będzie klasyfikator
|
||||||
|
@ -2,11 +2,20 @@ from classes.Garbage import *
|
|||||||
|
|
||||||
|
|
||||||
class Household:
|
class Household:
|
||||||
def __init__(self):
|
def __init__(self, mult):
|
||||||
|
self.mult = mult
|
||||||
self.id: int = 0
|
self.id: int = 0
|
||||||
self.image: object = None
|
self.image: object = None
|
||||||
self.position: tuple = None
|
self.position: tuple = None
|
||||||
self.garbage: object = Garbage()
|
self.garbage: object = Garbage()
|
||||||
|
self.final = False
|
||||||
|
|
||||||
|
def getFinal(self):
|
||||||
|
return self.final
|
||||||
|
|
||||||
|
def switchFinal(self):
|
||||||
|
self.final = False if self.final else True
|
||||||
|
return self
|
||||||
|
|
||||||
def setPosition(self, position: tuple):
|
def setPosition(self, position: tuple):
|
||||||
self.position = position
|
self.position = position
|
||||||
@ -38,16 +47,16 @@ class Household:
|
|||||||
|
|
||||||
def printme(self):
|
def printme(self):
|
||||||
x, y = self.getPosition()
|
x, y = self.getPosition()
|
||||||
return 32*x, 32*y
|
return self.mult*x, self.mult*y
|
||||||
|
|
||||||
|
|
||||||
def generateHousehold(i, image, position):
|
def generateHousehold(mult, i, image, position):
|
||||||
"""
|
"""
|
||||||
:param int i:
|
:param int i:
|
||||||
:param object image:
|
:param object image:
|
||||||
:param tuple position:
|
:param tuple position:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
house = Household()
|
house = Household(mult)
|
||||||
house.setId(i).setImage(image).setPosition(position)
|
house.setId(i).setImage(image).setPosition(position)
|
||||||
return house
|
return house
|
||||||
|
22
classes/Node.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
class Node:
|
||||||
|
def __init__(self, state):
|
||||||
|
self.state = state
|
||||||
|
self.action = ""
|
||||||
|
self.parent: Node = None
|
||||||
|
|
||||||
|
def getState(self):
|
||||||
|
return self.state
|
||||||
|
|
||||||
|
def getAction(self):
|
||||||
|
return self.action
|
||||||
|
|
||||||
|
def setAction(self, action):
|
||||||
|
self.action = action
|
||||||
|
return self
|
||||||
|
|
||||||
|
def getParent(self):
|
||||||
|
return self.parent if self.parent else False
|
||||||
|
|
||||||
|
def setParent(self, parent):
|
||||||
|
self.parent = parent
|
||||||
|
return self
|
@ -4,32 +4,32 @@ import numpy as np
|
|||||||
|
|
||||||
class Tilemap:
|
class Tilemap:
|
||||||
|
|
||||||
def __init__(self, tileset, size=(30, 20), rect=None):
|
def __init__(self, tileset, mult, size=(30, 20), rect=None):
|
||||||
self.size = size
|
self.size = size
|
||||||
self.tileset = tileset
|
self.tileset = tileset
|
||||||
self.map = np.zeros(size, dtype=int)
|
self.map = np.zeros(size, dtype=int)
|
||||||
w, h = self.size
|
w, h = self.size
|
||||||
self.image = pygame.Surface((32*w, 32*h))
|
self.image = pygame.Surface((mult*w, mult*h))
|
||||||
if rect:
|
if rect:
|
||||||
self.rect = pygame.Rect(rect)
|
self.rect = pygame.Rect(rect)
|
||||||
else:
|
else:
|
||||||
self.rect = self.image.get_rect()
|
self.rect = self.image.get_rect()
|
||||||
|
|
||||||
def render(self):
|
def render(self, mult):
|
||||||
m, n = self.map.shape
|
m, n = self.map.shape
|
||||||
for i in range(m):
|
for i in range(m):
|
||||||
for j in range(n):
|
for j in range(n):
|
||||||
tile = self.tileset.tiles[self.map[i, j]]
|
tile = self.tileset.tiles[self.map[i, j]]
|
||||||
self.image.blit(tile, (i*32, j*32))
|
self.image.blit(tile, (i*mult, j*mult))
|
||||||
|
|
||||||
def set_zero(self):
|
def set_zero(self, mult):
|
||||||
self.map = np.zeros(self.size, dtype=int)
|
self.map = np.zeros(self.size, dtype=int)
|
||||||
self.render()
|
self.render(mult)
|
||||||
|
|
||||||
def set_random(self):
|
def set_random(self, mult):
|
||||||
n = len(self.tileset.tiles)
|
n = len(self.tileset.tiles)
|
||||||
self.map = np.random.randint(n, size=self.size)
|
self.map = np.random.randint(n, size=self.size)
|
||||||
self.render()
|
self.render(mult)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'{self.__class__.__name__} {self.size}'
|
return f'{self.__class__.__name__} {self.size}'
|
||||||
|
@ -3,12 +3,13 @@ import pygame
|
|||||||
|
|
||||||
class Tileset:
|
class Tileset:
|
||||||
|
|
||||||
def __init__(self, file, size=(32, 32), margin=1, spacing=1):
|
def __init__(self, file, mult, margin=1, spacing=1):
|
||||||
self.file = file
|
self.file = file
|
||||||
self.size = size
|
self.size = (mult, mult)
|
||||||
self.margin = margin
|
self.margin = margin
|
||||||
self.spacing = spacing
|
self.spacing = spacing
|
||||||
self.image = pygame.image.load(file)
|
self.image = pygame.image.load(file)
|
||||||
|
self.image = pygame.transform.scale(self.image, self.size)
|
||||||
self.rect = self.image.get_rect()
|
self.rect = self.image.get_rect()
|
||||||
self.tiles = []
|
self.tiles = []
|
||||||
self.load()
|
self.load()
|
||||||
|
@ -1,9 +1,18 @@
|
|||||||
class Trashcan:
|
class Trashcan:
|
||||||
def __init__(self):
|
def __init__(self, mult):
|
||||||
|
self.mult = mult
|
||||||
self.id: int = 0
|
self.id: int = 0
|
||||||
self.image: object = None
|
self.image: object = None
|
||||||
self.position: tuple = None
|
self.position: tuple = None
|
||||||
self.trashtype: str = None
|
self.trashtype: str = None
|
||||||
|
self.final = False
|
||||||
|
|
||||||
|
def getFinal(self):
|
||||||
|
return self.final
|
||||||
|
|
||||||
|
def switchFinal(self):
|
||||||
|
self.final = False if self.final else True
|
||||||
|
return self
|
||||||
|
|
||||||
def setPosition(self, position: tuple):
|
def setPosition(self, position: tuple):
|
||||||
self.position = position
|
self.position = position
|
||||||
@ -35,10 +44,10 @@ class Trashcan:
|
|||||||
|
|
||||||
def printme(self):
|
def printme(self):
|
||||||
x, y = self.getPosition()
|
x, y = self.getPosition()
|
||||||
return 32*x, 32*y
|
return self.mult*x, self.mult*y
|
||||||
|
|
||||||
|
|
||||||
def generateTrashcan(newId, image, position, trashtype):
|
def generateTrashcan(mult, newId, image, position, trashtype):
|
||||||
"""
|
"""
|
||||||
:param int newId:
|
:param int newId:
|
||||||
:param string image:
|
:param string image:
|
||||||
@ -46,6 +55,6 @@ def generateTrashcan(newId, image, position, trashtype):
|
|||||||
:param string trashtype:
|
:param string trashtype:
|
||||||
:return object Trashcan:
|
:return object Trashcan:
|
||||||
"""
|
"""
|
||||||
trash = Trashcan()
|
trash = Trashcan(mult)
|
||||||
trash.setId(newId).setImage(image).setPosition(position).setTrashtype(trashtype)
|
trash.setId(newId).setImage(image).setPosition(position).setTrashtype(trashtype)
|
||||||
return trash
|
return trash
|
||||||
|
@ -7,7 +7,7 @@ from QOLfunc import *
|
|||||||
import pygame
|
import pygame
|
||||||
|
|
||||||
|
|
||||||
def trashcanGenerator() -> list:
|
def trashcanGenerator(mult) -> list:
|
||||||
typelist = ["paper", "metals_and_plastics", "mixed", "bio_waste", "glass"]
|
typelist = ["paper", "metals_and_plastics", "mixed", "bio_waste", "glass"]
|
||||||
trash_cans = [
|
trash_cans = [
|
||||||
{'position': (1, 0), 'type': 'paper'},
|
{'position': (1, 0), 'type': 'paper'},
|
||||||
@ -25,22 +25,25 @@ def trashcanGenerator() -> list:
|
|||||||
}
|
}
|
||||||
trashcans = []
|
trashcans = []
|
||||||
for key in trash_can_images:
|
for key in trash_can_images:
|
||||||
trash_can_images[key] = pygame.transform.scale(trash_can_images[key], (32,32))
|
trash_can_images[key] = pygame.transform.scale(trash_can_images[key], (mult, mult))
|
||||||
for i in range(5):
|
for i in range(5):
|
||||||
trashcan = generateTrashcan(i, trash_can_images[typelist[i]], trash_cans[i]["position"], trash_cans[i]["type"])
|
trashcan = generateTrashcan(mult, i, trash_can_images[typelist[i]], trash_cans[i]["position"],
|
||||||
|
trash_cans[i]["type"])
|
||||||
trashcans.append(trashcan)
|
trashcans.append(trashcan)
|
||||||
|
|
||||||
return trashcans
|
return trashcans
|
||||||
|
|
||||||
|
|
||||||
def householdGenerator():
|
def householdGenerator(mult):
|
||||||
new_house_size = (32, 32)
|
new_house_size = (mult, mult)
|
||||||
house_positions = [(15, 5), (17, 5), (19, 5), (21, 5), (15, 8), (17, 8), (19, 8), (21, 8)]
|
house_positions = [(15, 5), (17, 5), (19, 5), (21, 5), (15, 8), (17, 8), (19, 8), (21, 8)]
|
||||||
houses = []
|
houses = []
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
house_image = pygame.image.load(f'sprites/domek.png')
|
house_image = pygame.image.load(f'sprites/domek.png')
|
||||||
house_image = pygame.transform.scale(house_image, new_house_size)
|
house_image = pygame.transform.scale(house_image, new_house_size)
|
||||||
house = generateHousehold(i, house_image, house_positions[i])
|
house = generateHousehold(mult, i, house_image, house_positions[i])
|
||||||
|
if i == 1:
|
||||||
|
house.switchFinal()
|
||||||
houses.append(house)
|
houses.append(house)
|
||||||
|
|
||||||
return houses
|
return houses
|
||||||
|
38
main.py
@ -1,16 +1,21 @@
|
|||||||
|
import pygame.transform
|
||||||
|
|
||||||
from generators import *
|
from generators import *
|
||||||
|
import time
|
||||||
|
|
||||||
W = 30
|
W = 30
|
||||||
H = 20
|
H = 20
|
||||||
MULT = 32
|
MULT = 50
|
||||||
SIZE = (MULT*W, MULT*H)
|
SIZE = (MULT*W, MULT*H)
|
||||||
pygame.init()
|
pygame.init()
|
||||||
screen = pygame.display.set_mode(SIZE)
|
screen = pygame.display.set_mode(SIZE)
|
||||||
tilemap = Tilemap(Tileset("sprites/Tiles/1 Tiles/FieldsTile_38.png"), (W, H))
|
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()
|
trashcans = trashcanGenerator(MULT)
|
||||||
houses = householdGenerator()
|
houses = householdGenerator(MULT)
|
||||||
garbagetruck = Garbagetruck().setHouses(houses).setTrashcans(trashcans)
|
garbagetruck = Garbagetruck(MULT).setHouses(houses).setTrashcans(trashcans)
|
||||||
|
|
||||||
running = True
|
running = True
|
||||||
while running:
|
while running:
|
||||||
@ -18,14 +23,33 @@ while running:
|
|||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
running = False
|
running = False
|
||||||
|
|
||||||
|
print(garbagetruck.movesequence)
|
||||||
|
garbagetruck.setTarget()
|
||||||
|
garbagetruck.executeMovement()
|
||||||
screen.fill((0, 0, 0))
|
screen.fill((0, 0, 0))
|
||||||
tilemap.render()
|
tilemap.render(MULT)
|
||||||
screen.blit(tilemap.image, tilemap.rect)
|
screen.blit(tilemap.image, tilemap.rect)
|
||||||
screen.blit(garbagetruck.getImage(), garbagetruck.printme())
|
|
||||||
for i in trashcans:
|
for i in trashcans:
|
||||||
screen.blit(i.getImage(), i.printme())
|
screen.blit(i.getImage(), i.printme())
|
||||||
for h in houses:
|
for h in houses:
|
||||||
screen.blit(h.getImage(), h.printme())
|
screen.blit(h.getImage(), h.printme())
|
||||||
|
print(garbagetruck.getPosition())
|
||||||
|
bruh = garbagetruck.target.getPosition()
|
||||||
|
bruhlist = [i*MULT for i in bruh]
|
||||||
|
screen.blit(targimage, bruhlist)
|
||||||
|
screen.blit(garbagetruck.getImage(), garbagetruck.printme())
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
|
garbagetruck.scanTile()
|
||||||
|
state = garbagetruck.getState()
|
||||||
|
if not garbagetruck.movesequence:
|
||||||
|
moves = garbagetruck.graphsearch()
|
||||||
|
garbagetruck.setMovesequence(moves)
|
||||||
|
if state:
|
||||||
|
if state.getFinal():
|
||||||
|
garbagetruck.getState().switchFinal()
|
||||||
|
elif not garbagetruck.movesequence:
|
||||||
|
garbagetruck.randomTarget()
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
|
||||||
pygame.quit()
|
pygame.quit()
|
||||||
|
BIN
sprites/TIles/1 Tiles/FieldsTile_01.png
Normal file
After Width: | Height: | Size: 462 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_02.png
Normal file
After Width: | Height: | Size: 515 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_03.png
Normal file
After Width: | Height: | Size: 522 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_04.png
Normal file
After Width: | Height: | Size: 530 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_05.png
Normal file
After Width: | Height: | Size: 484 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_06.png
Normal file
After Width: | Height: | Size: 560 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_07.png
Normal file
After Width: | Height: | Size: 521 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_08.png
Normal file
After Width: | Height: | Size: 591 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_09.png
Normal file
After Width: | Height: | Size: 544 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_10.png
Normal file
After Width: | Height: | Size: 541 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_11.png
Normal file
After Width: | Height: | Size: 454 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_12.png
Normal file
After Width: | Height: | Size: 571 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_13.png
Normal file
After Width: | Height: | Size: 532 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_14.png
Normal file
After Width: | Height: | Size: 540 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_15.png
Normal file
After Width: | Height: | Size: 589 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_16.png
Normal file
After Width: | Height: | Size: 512 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_17.png
Normal file
After Width: | Height: | Size: 529 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_18.png
Normal file
After Width: | Height: | Size: 456 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_19.png
Normal file
After Width: | Height: | Size: 544 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_20.png
Normal file
After Width: | Height: | Size: 464 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_21.png
Normal file
After Width: | Height: | Size: 521 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_22.png
Normal file
After Width: | Height: | Size: 580 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_23.png
Normal file
After Width: | Height: | Size: 504 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_24.png
Normal file
After Width: | Height: | Size: 613 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_25.png
Normal file
After Width: | Height: | Size: 546 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_26.png
Normal file
After Width: | Height: | Size: 559 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_27.png
Normal file
After Width: | Height: | Size: 443 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_28.png
Normal file
After Width: | Height: | Size: 592 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_29.png
Normal file
After Width: | Height: | Size: 554 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_30.png
Normal file
After Width: | Height: | Size: 584 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_31.png
Normal file
After Width: | Height: | Size: 551 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_32.png
Normal file
After Width: | Height: | Size: 571 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_33.png
Normal file
After Width: | Height: | Size: 487 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_34.png
Normal file
After Width: | Height: | Size: 519 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_35.png
Normal file
After Width: | Height: | Size: 538 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_36.png
Normal file
After Width: | Height: | Size: 531 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_37.png
Normal file
After Width: | Height: | Size: 505 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_38.png
Normal file
After Width: | Height: | Size: 139 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_39.png
Normal file
After Width: | Height: | Size: 584 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_40.png
Normal file
After Width: | Height: | Size: 588 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_41.png
Normal file
After Width: | Height: | Size: 602 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_42.png
Normal file
After Width: | Height: | Size: 599 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_43.png
Normal file
After Width: | Height: | Size: 643 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_44.png
Normal file
After Width: | Height: | Size: 597 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_45.png
Normal file
After Width: | Height: | Size: 530 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_46.png
Normal file
After Width: | Height: | Size: 535 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_47.png
Normal file
After Width: | Height: | Size: 590 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_48.png
Normal file
After Width: | Height: | Size: 626 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_49.png
Normal file
After Width: | Height: | Size: 602 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_50.png
Normal file
After Width: | Height: | Size: 593 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_51.png
Normal file
After Width: | Height: | Size: 577 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_52.png
Normal file
After Width: | Height: | Size: 580 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_53.png
Normal file
After Width: | Height: | Size: 549 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_54.png
Normal file
After Width: | Height: | Size: 529 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_55.png
Normal file
After Width: | Height: | Size: 561 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_56.png
Normal file
After Width: | Height: | Size: 555 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_57.png
Normal file
After Width: | Height: | Size: 555 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_58.png
Normal file
After Width: | Height: | Size: 554 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_59.png
Normal file
After Width: | Height: | Size: 571 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_60.png
Normal file
After Width: | Height: | Size: 551 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_61.png
Normal file
After Width: | Height: | Size: 548 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_62.png
Normal file
After Width: | Height: | Size: 537 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_63.png
Normal file
After Width: | Height: | Size: 557 B |
BIN
sprites/TIles/1 Tiles/FieldsTile_64.png
Normal file
After Width: | Height: | Size: 545 B |
BIN
sprites/TIles/1 Tiles/FieldsTileset.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
sprites/TIles/1 Tiles/FieldsTilesetTest.png
Normal file
After Width: | Height: | Size: 594 B |
BIN
sprites/X.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
sprites/smieciara.png
Normal file
After Width: | Height: | Size: 13 KiB |