Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- # Define colors
- white=[255,255,255]
- black=[0,0,0]
- blue = [0, 0, 255]
- # Call this function so the Pygame library can initialize itself
- pygame.init()
- # Create screen
- screen = pygame.display.set_mode([384, 326])
- # This sets the name of the window
- pygame.display.set_caption('Ironing Maiden')
- # Create a surface we can draw on, and one to count pixels
- background = pygame.Surface(screen.get_size())
- drawing_surface = pygame.Surface(screen.get_size())
- # Fill the screen with a black background
- background.fill(black)
- clock = pygame.time.Clock()
- # Before the loop, load the sounds
- pygame.mixer.music.load('C:\Users\Ian\Music\ironing_maiden.wav')
- #pygame.mixer.music.play(-1, 0.0)
- # Set positions of graphics
- background_position=[0,0]
- # Load and set up graphics
- background_image = pygame.image.load("C:\Users\Ian\Pictures\ironingmaiden.jpg").convert()
- player_image = pygame.image.load("C:\Users\Ian\Pictures\iron.png").convert()
- done = False
- mousedown = False
- # Copy image to screen for background
- screen.blit(background_image, background_position)
- def win():
- #Count the number of colored pixels in the drawing surface. If this number is over a threshold,
- #the player wins
- pygame.transform(drawing_surface, change_return=0)
- return num_threshold_pixels
- while done==False:
- clock.tick(24)
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- done=True
- elif event.type == pygame.MOUSEBUTTONDOWN:
- mousedown = True
- elif event.type == pygame.MOUSEBUTTONUP:
- mousedown = False
- #pygame.transform.threshold(drawing_surface, blue, threshold = (0,0,0,0), diff_color = (0,0,0,255), change_return = 0, Surface = None, inverse = False)
- #print num_threshold_pixels
- if mousedown == True:
- pygame.draw.circle(drawing_surface,blue,((x+50),(y+50)),20)
- pygame.draw.circle(screen,blue,((x+50),(y+50)),20)
- win();
- # Get the current mouse position.
- player_position = pygame.mouse.get_pos()
- x=(player_position[0]-50)
- y=(player_position[1]-50)
- # Copy cusor overlay image to screen:
- #screen.blit(player_image, [x,y])
- #This does not work yet
- pygame.display.flip()
- pygame.quit ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement