.
.
This commit is contained in:
parent
5287243362
commit
73a5d67d39
21
board
21
board
@ -8,6 +8,7 @@ import pygame
|
||||
|
||||
screen = []
|
||||
objectArray = []
|
||||
pathToPrint = []
|
||||
|
||||
class Object:
|
||||
def __init__(self, name, xPos, yPos):
|
||||
@ -56,13 +57,14 @@ def draw(square_num, objectArr):
|
||||
circleY = objectArr[0].yPos * square - square / 2
|
||||
#radius = 10
|
||||
#pygame.draw.circle(screen, agent_color, (a + circleX, b + circleY), radius)
|
||||
truck = pygame.image.load("car.png").convert_alpha() #tu ścieżka do zdjęcia w tle
|
||||
truck = pygame.transform.scale(truck, (square, square))
|
||||
screen.blit(truck, (circleX, circleY))
|
||||
# truck = pygame.image.load("car.png").convert_alpha() #tu ścieżka do zdjęcia w tle
|
||||
# truck = pygame.transform.scale(truck, (square, square))
|
||||
# screen.blit(truck, (circleX, circleY))
|
||||
pygame.draw.polygon(screen, (0, 0, 255), [(10 + circleX, 5 + circleY),(20 + circleX, 5 + circleY),(15 + circleX, 20 + circleY)])
|
||||
|
||||
circleX = objectArray[1].xPos * square + square
|
||||
circleY = objectArr[1].yPos * square
|
||||
radius = 10
|
||||
radius = 8
|
||||
grid_color = (255, 0, 0)
|
||||
pygame.draw.circle(screen, grid_color, (circleX, circleY), radius)
|
||||
|
||||
@ -171,7 +173,7 @@ if __name__ == '__main__':
|
||||
print("RED DOT X AND Y POSITION ============================")
|
||||
result.printXandY()
|
||||
print("TRUCK X AND Y POSITION ============================")
|
||||
print("X: " + str(objectArray[0].xPos - 1) + " Y: " + str(objectArray[0].yPos - 1))
|
||||
print("X: " + str(objectArray[0].xPos) + " Y: " + str(objectArray[0].yPos))
|
||||
|
||||
|
||||
result_parent = result.parent
|
||||
@ -189,10 +191,17 @@ if __name__ == '__main__':
|
||||
for node in pathToTarget:
|
||||
node.printXandY()
|
||||
|
||||
|
||||
while 1:
|
||||
c = (255, 255, 255) #tymczasowy kolor tła - do usunięcia, jak już będzie zdjęcie
|
||||
screen.fill(c)
|
||||
draw(15, objectArray)
|
||||
|
||||
## TUTAJ RYSUJEMY SCIEZKE
|
||||
for node in pathToTarget:
|
||||
if node == pathToTarget[-1]:
|
||||
continue
|
||||
green = (0, 255, 0)
|
||||
pygame.draw.circle(screen, green, ((node.xPos + 1) * 500 / 15 + 30, (node.yPos + 1) * 500 / 15), 5)
|
||||
|
||||
kb_listen(objectArray, 15)
|
||||
pygame.display.update() #by krata pojawiła się w okienku - update powierzchni
|
||||
|
Loading…
Reference in New Issue
Block a user