From 69fe1fb1cde9eed97d4dc5e2d6d43cf0205d7081 Mon Sep 17 00:00:00 2001 From: Cezary Adamczak Date: Sun, 28 Mar 2021 23:51:53 +0200 Subject: [PATCH] =?UTF-8?q?Usu=C5=84=20'tractor.py'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tractor.py | 60 ------------------------------------------------------ 1 file changed, 60 deletions(-) delete mode 100644 tractor.py diff --git a/tractor.py b/tractor.py deleted file mode 100644 index 3b6b1bf..0000000 --- a/tractor.py +++ /dev/null @@ -1,60 +0,0 @@ -import pygame - -from pygame.locals import ( - K_UP, - K_DOWN, - K_LEFT, - K_RIGHT, - K_ESCAPE, - K_SPACE, - K_c, - KEYDOWN, - QUIT -) - -from dimensions import * -from colors import * - -class Tractor(pygame.sprite.Sprite): - def __init__(self, field): - super(Tractor, self).__init__() - self.surf = pygame.Surface((WIDTH, HEIGHT)) - self.surf.fill(RED) - self.position = field.position - self.rect = self.surf.get_rect( - topleft=((MARGIN + WIDTH) * self.position[0] + MARGIN, (MARGIN + HEIGHT) * self.position[1] + MARGIN)) - self.field = field - - def update(self, pressed_keys): - if pressed_keys[K_UP]: - self.rect.move_ip(0, -(HEIGHT + MARGIN)) - self.position[1] -= 1 - if self.rect.top <= MARGIN: - self.rect.top = MARGIN - self.position[1] = 0 - if pressed_keys[K_DOWN]: - self.rect.move_ip(0, HEIGHT + MARGIN) - self.position[1] += 1 - if self.rect.bottom >= SCREEN_HEIGHT-MARGIN: - self.rect.bottom = SCREEN_HEIGHT-MARGIN - self.position[1] = GSIZE-1 - if pressed_keys[K_LEFT]: - self.rect.move_ip(-(WIDTH + MARGIN), 0) - self.position[0] -= 1 - if self.rect.left < MARGIN: - self.rect.left = MARGIN - self.position[0] = 0 - if pressed_keys[K_RIGHT]: - self.rect.move_ip(WIDTH + MARGIN, 0) - self.position[0] += 1 - if self.rect.right > SCREEN_WIDTH-MARGIN: - self.rect.right = SCREEN_WIDTH-MARGIN - self.position[0] = GSIZE-1 - - def hydrate(self, field, pressed_keys): - if pressed_keys[K_SPACE]: - field[self.position[0]][self.position[1]].hydrate() - - def cut(self, field, pressed_keys): - if pressed_keys[K_c]: - field[self.position[0]][self.position[1]].free()