From 19e42bbdf9cd47e6ee91fb506212a1d80450d0ca Mon Sep 17 00:00:00 2001 From: secret_dude Date: Mon, 29 Mar 2021 21:14:07 +0200 Subject: [PATCH 1/3] V. 12 --- drawUI.py | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/drawUI.py b/drawUI.py index 1505326..a2d6644 100644 --- a/drawUI.py +++ b/drawUI.py @@ -5,12 +5,12 @@ import pygame def drawUI(board, display, tractor, direction, tillageUnit, field): - display.fill(WHITE) - makeField(board, display) - drawTractor(display, tractor.horizontal_index, tractor.vertical_index, direction) - drawInfo(display, tractor, tillageUnit, field) - - pygame.display.update() + for i in range(1, 11): + display.fill(WHITE) + makeField(board, display) + drawTractor(display, tractor.horizontal_index, tractor.vertical_index, direction, i) + drawInfo(display, tractor, tillageUnit, field) + pygame.display.update() def drawInfo(display, tractor, tillageUnit, field): @@ -54,14 +54,21 @@ def makeField(board, screen: pygame.Surface): screen.blit(do_zebrania, do_zebrania_rect) -def drawTractor(screen: pygame.Surface, tractor_horizontal_index, tractor_vertical_index, direction): +def drawTractor(screen: pygame.Surface, tractor_horizontal_index, tractor_vertical_index, direction, i): + tractor_pic = tractor_up + horizontal = tractor_horizontal_index * TILE_SIZE + vertical = tractor_vertical_index * TILE_SIZE if direction == "UP": - screen.blit(tractor_up, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE)) - elif direction == "DOWN": - screen.blit(tractor_down, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE)) - elif direction == "LEFT": - screen.blit(tractor_left, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE)) - elif direction == "RIGHT": - screen.blit(tractor_right, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE)) - else: - screen.blit(tractor_right, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE)) + tractor_pic = tractor_up + vertical = vertical + (TILE_SIZE / i) + if direction == "DOWN": + tractor_pic = tractor_down + vertical = vertical - (TILE_SIZE / i) + if direction == "LEFT": + tractor_pic = tractor_left + horizontal = horizontal + (TILE_SIZE/i) + if direction == "RIGHT": + tractor_pic = tractor_right + horizontal = horizontal - (TILE_SIZE/i) + + screen.blit(tractor_pic, (horizontal, vertical)) From 6524408bc9ecbe2097dd2ea9806288473a4aeb95 Mon Sep 17 00:00:00 2001 From: secret_dude Date: Mon, 29 Mar 2021 21:18:14 +0200 Subject: [PATCH 2/3] V. 12 --- .idea/.gitignore | 2 ++ .idea/AI_PRO2.iml | 8 ++++++++ .idea/inspectionProfiles/profiles_settings.xml | 6 ++++++ .idea/misc.xml | 4 ++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ drawUI.py | 13 ++++++++----- 7 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/AI_PRO2.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e7e9d11 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml diff --git a/.idea/AI_PRO2.iml b/.idea/AI_PRO2.iml new file mode 100644 index 0000000..12188ff --- /dev/null +++ b/.idea/AI_PRO2.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..43a1e8a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..d675357 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/drawUI.py b/drawUI.py index a2d6644..5dc5876 100644 --- a/drawUI.py +++ b/drawUI.py @@ -5,7 +5,7 @@ import pygame def drawUI(board, display, tractor, direction, tillageUnit, field): - for i in range(1, 11): + for i in range(1, 21): display.fill(WHITE) makeField(board, display) drawTractor(display, tractor.horizontal_index, tractor.vertical_index, direction, i) @@ -58,17 +58,20 @@ def drawTractor(screen: pygame.Surface, tractor_horizontal_index, tractor_vertic tractor_pic = tractor_up horizontal = tractor_horizontal_index * TILE_SIZE vertical = tractor_vertical_index * TILE_SIZE + + i = i/10 + if direction == "UP": tractor_pic = tractor_up - vertical = vertical + (TILE_SIZE / i) + vertical = vertical + (TILE_SIZE * i) if direction == "DOWN": tractor_pic = tractor_down - vertical = vertical - (TILE_SIZE / i) + vertical = vertical - (TILE_SIZE * i) if direction == "LEFT": tractor_pic = tractor_left - horizontal = horizontal + (TILE_SIZE/i) + horizontal = horizontal + (TILE_SIZE * i) if direction == "RIGHT": tractor_pic = tractor_right - horizontal = horizontal - (TILE_SIZE/i) + horizontal = horizontal - (TILE_SIZE * i) screen.blit(tractor_pic, (horizontal, vertical)) From 736af08577a1854314b35ebfb01307c932490e82 Mon Sep 17 00:00:00 2001 From: secret_dude Date: Mon, 29 Mar 2021 21:18:55 +0200 Subject: [PATCH 3/3] V. 12 --- drawUI.py | 1 + 1 file changed, 1 insertion(+) diff --git a/drawUI.py b/drawUI.py index 5dc5876..dfc98ca 100644 --- a/drawUI.py +++ b/drawUI.py @@ -59,6 +59,7 @@ def drawTractor(screen: pygame.Surface, tractor_horizontal_index, tractor_vertic horizontal = tractor_horizontal_index * TILE_SIZE vertical = tractor_vertical_index * TILE_SIZE + i = i/10 if direction == "UP":