Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- from platforma import Platforma
- SZEROKOSC=1024
- WYSOKOSC=800
- ekran=pygame.display.set_mode([SZEROKOSC,WYSOKOSC])
- obraz_tla=pygame.image.load('images/background.png')
- status_gry=True
- platforma=Platforma()
- while status_gry:
- for zdarzenie in pygame.event.get():
- if zdarzenie.type==pygame.QUIT:
- status_gry=False
- elif zdarzenie.type==pygame.KEYDOWN:
- if zdarzenie.key==pygame.K_ESCAPE:
- status_gry=False
- keys=pygame.key.get_pressed()#pobieranie wciśniętych(i tzymanych)
- if keys[pygame.K_a] or keys[pygame.K_LEFT]:
- platforma.przesun(-1)
- if keys[pygame.K_d] or keys[pygame.K_RIGHT]:
- platforma.przesun(1)
- ekran.blit(obraz_tla,(0,0))
- ekran.blit(platforma.obraz,platforma.rect)
- pygame.display.flip()
- pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement