Merge pull request 'Forklift image' (#2) from s473598_wozek_image into master
Reviewed-on: #2
This commit is contained in:
commit
ae5614369f
23
main.py
23
main.py
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user