Forklift image #2
25
main.py
25
main.py
@ -3,10 +3,25 @@ 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)
|
||||||
|
|
||||||
while True:
|
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:
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user