Traktor/tractor.py
2024-03-24 19:28:14 +01:00

18 lines
575 B
Python

import pygame
from constant import size
class Tractor:
def __init__(self, row, col):
self.row = row
self.col = col
self.images = {
"up": pygame.image.load("tractor/up.png"),
"down": pygame.image.load("tractor/down.png"),
"left": pygame.image.load("tractor/left.png"),
"right":pygame.image.load("tractor/right.png")
}
self.direction = "down"
def draw(self, win):
tractor_image = self.images[self.direction]
win.blit(tractor_image, (self.col*size, self.row*size))