Advertisement
Guest User

FIGHTERS

a guest
Apr 9th, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. import pygame
  2.  
  3. from pygame.locals import (
  4.     K_UP,
  5.     K_DOWN,
  6.     K_LEFT,
  7.     K_RIGHT,
  8.     K_ESCAPE,
  9.     KEYDOWN,
  10.     QUIT,
  11. )
  12.  
  13. #initialize game
  14. pygame.init()
  15.  
  16.  
  17. SCREEN_WIDTH = 800
  18. SCREEN_HEIGHT = 600
  19.  
  20. screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
  21.  
  22. screen.fill((255,255,255))
  23.  
  24. fighter = pygame.Surface((50,50))
  25.  
  26. fighter.fill((0,0,0))
  27. rect = fighter.get_rect()
  28.  
  29. screen.blit(fighter, (SCREEN_WIDTH/2,SCREEN_HEIGHT/2))
  30. pygame.display.flip()
  31.  
  32. running = True
  33.  
  34. #Main Loop
  35. while running:
  36.    
  37.     for event in pygame.event.get():
  38.        
  39.         if event.type == KEYDOWN:
  40.            
  41.             if event.key == K_ESCAPE:
  42.                 running = False
  43.  
  44.         elif event.type == QUIT:
  45.             running = False
  46.  
  47.  
  48.  
  49.  
  50. pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement