Advertisement
Guest User

Untitled

a guest
May 28th, 2015
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. def main():
  2. pygame.init()
  3. WIDTH, HEIGHT = 640, 480
  4. BLACK = (0, 0, 0)
  5. WHITE = (255, 255, 255)
  6.  
  7. screen = pygame.display.set_mode((WIDTH, HEIGHT), 0, 32)
  8. pygame.display.set_caption('Space War')
  9.  
  10. FPS = 30
  11. fps_clock = pygame.time.Clock() # clock is object, Clock is class
  12.  
  13. pirate = starship.Ship('pirate ship0', 100, 100, 90)
  14.  
  15. while True: # game loop
  16. screen.fill(WHITE)
  17.  
  18. #PROCESSES
  19. checkForQuit()
  20. for event in pygame.event.get():
  21. if event.type == KEYUP:
  22. print(event.key)
  23. if event.key in (K_ESCAPE):
  24. terminate()
  25. if event.key in (K_k):
  26. pirate.accelerate()
  27. if event.key in (K_j):
  28. pirate.rotate_left(5)
  29. if event.key in (K_l):
  30. pirate.rotate_right(5)
  31.  
  32. #LOGIC
  33. pirate.move()
  34. # if pirate.speed > 1:
  35. # pirate.speed -= 1 # all ships have drag!
  36. # else:
  37. # pirate.speed = 0
  38.  
  39. #DRAW
  40. screen.blit(pirate.image, (pirate.x, pirate.y))
  41.  
  42. #DRAW
  43. pygame.display.update()
  44. fps_clock.tick(FPS)
  45.  
  46. if __name__ == '__main__':
  47. main()
  48.  
  49. Status API Training Shop Blog About
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement