Advertisement
Guest User

afaf

a guest
Nov 12th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. import pygame
  2. import time
  3.  
  4. class GameConfig:
  5. windowW = 800
  6. windowH = 500
  7. white = (195,195,195)
  8. imgTour = pygame.image.load('tour.png')
  9. imgArme = pygame.image.load('arme.png')
  10.  
  11. tourW = 296
  12. tourH = 171
  13.  
  14. armeW = 360
  15. armeH = 360
  16.  
  17.  
  18. class GameState:
  19. def __init__(self):
  20. self.tourX = 0
  21. self.tourY = 500-171
  22. self.armeX =
  23. self.armeY =
  24. def draw(self,window):
  25. window.fill(GameConfig.white)
  26. window.blit(GameConfig.imgTour,(self.tourX,self.tourY))
  27. window.blit(GameConfig.imgArme,(self.armeX,self.armeY))
  28.  
  29.  
  30. def gameLoop(window):
  31. game_over = False
  32. gameState = GameState()
  33. while not game_over:
  34. for event in pygame.event.get() :
  35. if event.type == pygame.QUIT :
  36. game_over = True
  37. gameState.draw(window)
  38. pygame.display.update()
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48. def main():
  49.  
  50. pygame.init()
  51. window = pygame.display.set_mode((GameConfig.windowW, GameConfig.windowH))
  52. pygame.display.set_caption("Tower")
  53. gameLoop(window)
  54. pygame.quit()
  55. quit()
  56.  
  57. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement