AIprojekt-wozek/Truck.py

27 lines
1021 B
Python
Raw Permalink Normal View History

2022-03-24 20:02:21 +01:00
import pygame
from Field import Field
from Global_variables import Global_variables as G_var
2022-05-12 23:19:46 +02:00
from Sectors_types import Sectors_types
from Types_colors import Types_colors
from Package_types import Package_types
2022-03-24 20:02:21 +01:00
class Truck(Field):
def __init__(self, window, x, y):
Field.__init__(self, window, x, y)
2022-03-24 20:02:21 +01:00
self.image = pygame.image.load("resources/truck.jpeg").convert()
self.has_package = False
self.package_type = Package_types.fragile
2022-05-12 23:19:46 +02:00
self.sector = Sectors_types.fragile
2022-03-24 20:02:21 +01:00
# 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)