Advertisement
black_duck11

arkanoid.py

Jun 10th, 2025
866
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. import pygame
  2. from platforma import Platforma
  3. SZEROKOSC=1024
  4. WYSOKOSC=800
  5. ekran=pygame.display.set_mode([SZEROKOSC,WYSOKOSC])
  6. obraz_tla=pygame.image.load('images/background.png')
  7. status_gry=True
  8. platforma=Platforma()
  9. while status_gry:
  10.     for zdarzenie in pygame.event.get():
  11.         if zdarzenie.type==pygame.QUIT:
  12.             status_gry=False
  13.         elif zdarzenie.type==pygame.KEYDOWN:
  14.             if zdarzenie.key==pygame.K_ESCAPE:
  15.                 status_gry=False
  16.     keys=pygame.key.get_pressed()#pobieranie wciśniętych(i tzymanych)
  17.     if keys[pygame.K_a] or keys[pygame.K_LEFT]:
  18.         platforma.przesun(-1)
  19.     if keys[pygame.K_d] or keys[pygame.K_RIGHT]:
  20.         platforma.przesun(1)
  21.  
  22.     ekran.blit(obraz_tla,(0,0))
  23.     ekran.blit(platforma.obraz,platforma.rect)
  24.     pygame.display.flip()
  25. pygame.quit()
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement