forklift image

This commit is contained in:
Zuzanna Wójcik 2023-03-11 00:44:46 +01:00
parent 34dbe4dc57
commit fc494403a2
2 changed files with 46 additions and 27 deletions

23
main.py
View File

@ -3,9 +3,24 @@ import sys
pygame.init() pygame.init()
screen = pygame.display.set_mode((1280, 720)) screen = pygame.display.set_mode((1280, 720))
wozek = pygame.Rect(55,55,50,50)
c = (0, 150, 0) c = (0, 150, 0)
class Wozek:
def __init__(self):
self.x = 55
self.y = 55
self.height = 64
self.width = 64
self.image = pygame.image.load("wozek.png")
# Credit: Forklift icons created by Smashicons - Flaticon
# https://www.flaticon.com/free-icons/forklift
def draw(self):
screen.blit(self.image, (self.x, self.y))
def main():
wozek = Wozek()
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == pygame.QUIT: if event.type == pygame.QUIT:
@ -34,5 +49,9 @@ while True:
#Drawing #Drawing
screen.fill((0,0,0)) #removes object trail screen.fill((0,0,0)) #removes object trail
pygame.draw.rect(screen, (0,150,255), wozek) #resolution, color, object
pygame.display.flip() #updating frames pygame.display.flip() #updating frames
wozek.draw()
if __name__ == "__main__":
main()

BIN
wozek.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB