Traktor/tractor.py

18 lines
575 B
Python
Raw Normal View History

2024-03-10 02:46:14 +01:00
import pygame
from constant import size
class Tractor:
def __init__(self, row, col):
self.row = row
self.col = col
self.images = {
2024-03-24 19:28:14 +01:00
"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")
2024-03-10 02:46:14 +01:00
}
self.direction = "down"
2024-03-24 19:28:14 +01:00
2024-03-10 02:46:14 +01:00
def draw(self, win):
tractor_image = self.images[self.direction]
2024-03-24 19:28:14 +01:00
win.blit(tractor_image, (self.col*size, self.row*size))