16 lines
540 B
Python
16 lines
540 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("up.png"),
|
||
|
"down": pygame.image.load("down.png"),
|
||
|
"left":pygame.image.load("left.png"),
|
||
|
"right":pygame.image.load("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))
|