AIprojekt-wozek/Truck.py
2022-05-12 23:19:46 +02:00

27 lines
1021 B
Python

import pygame
from Field import Field
from Global_variables import Global_variables as G_var
from Sectors_types import Sectors_types
from Types_colors import Types_colors
from Package_types import Package_types
class Truck(Field):
def __init__(self, window, x, y):
Field.__init__(self, window, x, y)
self.image = pygame.image.load("resources/truck.jpeg").convert()
self.has_package = False
self.package_type = Package_types.fragile
self.sector = Sectors_types.fragile
# drawing the truck
def draw(self):
block = (self.x * G_var().RECT_SIZE, self.y * G_var().RECT_SIZE)
self.window.blit(
self.image, block)
if self.has_package:
package_color = Types_colors.get_package_color(self.package_type)
rect = pygame.Rect(self.x * G_var().RECT_SIZE, self.y *
G_var().RECT_SIZE, G_var().RECT_SIZE/2, G_var().RECT_SIZE/2)
pygame.draw.rect(self.window, package_color, rect)