This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 2nd, 2012  |  syntax: Python  |  size: 1.66 KB  |  views: 36  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import pygame
  2.  
  3. # Define colors
  4. white=[255,255,255]
  5. black=[0,0,0]
  6. blue = [0, 0, 255]
  7.  
  8. # Call this function so the Pygame library can initialize itself
  9. pygame.init()
  10.  
  11. # Create screen
  12. screen = pygame.display.set_mode([384, 326])
  13.  
  14. # This sets the name of the window
  15. pygame.display.set_caption('Ironing Maiden')
  16.  
  17. # Create a surface we can draw on
  18. background = pygame.Surface(screen.get_size())
  19.  
  20. # Fill the screen with a black background
  21. background.fill(black)
  22.  
  23. clock = pygame.time.Clock()
  24.  
  25. # Before the loop, load the sounds
  26. pygame.mixer.music.load('C:\Users\Ian\Music\ironing_maiden.wav')
  27. #pygame.mixer.music.play(-1, 0.0)
  28.  
  29. # Set positions of graphics
  30. background_position=[0,0]
  31.  
  32. # Load and set up graphics
  33. background_image = pygame.image.load("C:\Users\Ian\Pictures\ironingmaiden.jpg").convert()
  34. player_image = pygame.image.load("C:\Users\Ian\Pictures\iron.png").convert()
  35. player_image.set_colorkey(white)
  36.  
  37. done = False
  38.  
  39. mousedown = False
  40.  
  41. # Copy image to screen for background
  42. screen.blit(background_image, background_position)
  43.  
  44. while done==False:
  45.     clock.tick(24)
  46.  
  47.     for event in pygame.event.get():
  48.         if event.type == pygame.QUIT:
  49.             done=True
  50.         elif event.type == pygame.MOUSEBUTTONDOWN:
  51.             print "Left mouse button pressed"
  52.             pygame.draw.circle(screen,blue,((x+50),(y+50)),20)
  53.  
  54.     # Get the current mouse position.
  55.     player_position = pygame.mouse.get_pos()
  56.     x=(player_position[0]-50)
  57.     y=(player_position[1]-50)
  58.      
  59.     # Copy cusor overlay image to screen:
  60.     #screen.blit(player_image, [x,y])
  61.     #This does not work yet
  62.    
  63.     pygame.display.flip()
  64.  
  65. pygame.quit ()
clone this paste RAW Paste Data