fork download
  1. #! /usr/bin/python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import pygame
  5. from pygame import *
  6.  
  7. WIN_WIDTH = 800
  8. WIN_HEIGHT = 640
  9. DISPLAY = (WIN_WIDTH, WIN_HEIGHT)
  10. BACKGROUND_COLOR = '#004400'
  11. PLATFORM_WIDTH = 32
  12. PLATFORM_HEIGHT = 32
  13. PLATFORM_COLOR = '#FF6262'
  14.  
  15. def main():
  16. pygame.init()
  17. screen = pygame.display.set_mode(DISPLAY)
  18. pygame.display.set_caption('Game02')
  19. bg = Surface((WIN_WIDTH,WIN_HEIGHT))
  20.  
  21. bg.fill(Color(BACKGROUND_COLOR))
  22. level = [
  23. "-------------------------",
  24. "- -",
  25. "- -",
  26. "- -",
  27. "- -- -",
  28. "- -",
  29. "-- -",
  30. "- -",
  31. "- --- -",
  32. "- -",
  33. "- -",
  34. "- --- -",
  35. "- -",
  36. "- ----------- -",
  37. "- -",
  38. "- - -",
  39. "- -- -",
  40. "- -",
  41. "- -",
  42. "-------------------------"]
  43.  
  44. while 1:
  45.  
  46. x=y=0
  47. for row in level:
  48. for col in row:
  49. if col == '+':
  50. pf = Surface((PLATFORM_WIDTH, PLATFORM_HEIGHT))
  51. pf.fill(Color(PLATFORM_COLOR))
  52. screen.blit(pf,(x, y))
  53. x += PLATFORM_WIDTH
  54. y += PLATFORM_HEIGHT
  55. x = 0
  56. for e in pygame.event.get():
  57. if e.type == QUIT:
  58. raise SystemExit, 'QUIT'
  59. screen.blit(bg, (0, 0))
  60. pygame.display.update()
  61. if __name__ == '__main__':
  62. main()
Runtime error #stdin #stdout #stderr 0s 9024KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 4, in <module>
ImportError: No module named pygame