style: fix inconsistent spacing & add newline at end of files

This commit is contained in:
Wojciech Kubicki 2024-03-25 12:32:24 +01:00
parent c99e738034
commit e4aa771022
4 changed files with 7 additions and 4 deletions

View File

@ -9,6 +9,7 @@ class Field:
self.tiles.add(Tile(x, 'grass', self))
self.tractor = Tractor(self)
def draw(self, surface):
self.tiles.draw(surface)
self.tractor.draw(surface)
self.tractor.draw(surface)

View File

@ -24,4 +24,4 @@ if __name__ == "__main__":
field.draw(screen)
pygame.display.flip()
pygame.time.Clock().tick(10)
pygame.time.Clock().tick(10)

View File

@ -24,14 +24,14 @@ class Tile(pygame.sprite.Sprite):
self.rect = self.image.get_rect()
self.rect.topleft = (x * TILE_SIZE, y * TILE_SIZE)
def draw(self, surface):
self.tiles.draw(surface)
def set_type(self, type):
self.type = type
# if self.type == 'grass':
# self.image = pygame.image.load("images/grass.png").convert()
self.image = pygame.image.load("images/grass.png").convert()
self.image = pygame.transform.scale(self.image, (TILE_SIZE, TILE_SIZE))

View File

@ -8,9 +8,11 @@ class Tractor(pygame.sprite.Sprite):
def __init__(self, field):
super().__init__
self.field = field
self.image = pygame.image.load('images/tractor.png').convert_alpha()
self.image = pygame.transform.scale(self.image, (TILE_SIZE, TILE_SIZE))
self.rect = self.image.get_rect()
x, y = 0, 0
self.rect.topleft = (x, y)