Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- pygame.init()
- window = pygame.display.set_mode((400, 442))
- screen = pygame.Surface ((400, 442))
- gr = pygame.Surface ((400, 442))
- pygame.display.set_caption('pacman')
- player = pygame.Surface ((20, 20))
- zl = pygame.Surface ((20, 20))
- zl1 = pygame.Surface ((20, 20))
- zl2 = pygame.Surface ((20, 20))
- x1 = 300
- y1 = 300
- p_x = 0
- p_y = 0
- z_x = 210
- z_x1 = 190
- z_y = 200
- z_y1 = 200
- z_x2 = 170
- z_y2 = 200
- game_over = False
- Yes = True
- gr = pygame.image.load('opasno.jpg')
- icon = pygame.image.load('images.jpg')
- player.set_colorkey((255, 255, 255))
- icon.set_colorkey((255, 255, 255))
- zl2.set_colorkey((255, 255, 255))
- zl1.set_colorkey((255, 255, 255))
- zl.set_colorkey((255, 255, 255))
- img = pygame.image.load('fk.gif')
- img1 = pygame.image.load('pk.jpg')
- pr1 = pygame.image.load('or.png')
- pr2 = pygame.image.load('pink.png')
- prall = pygame.image.load('blue.png')
- pygame.Surface.get_alpha
- while not game_over:
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- game_over = True
- pygame.quit()
- if event.type == pygame.KEYDOWN:
- if event.key == pygame.K_LEFT:
- p_x = -1
- p_y = 0
- elif event.key == pygame.K_RIGHT:
- p_x = 1
- p_y = 0
- elif event.key == pygame.K_UP:
- p_y = -1
- p_x = 0
- elif event.key == pygame.K_DOWN:
- p_y = 1
- p_x = 0
- x1 += p_x
- y1 += p_y
- if x1 == 374:
- p_x = 0
- if y1 == 420:
- p_y = 0
- if x1 == -1:
- p_x = 0
- if y1 == 0:
- p_y = 0
- if x1 > 375:
- p_x -= 1
- if y1 > 421:
- p_y -= 1
- if x1 < -2:
- p_x += 1
- if y1 < -2:
- p_y += 1
- screen.blit(img1, (0, 0))
- pygame.display.set_icon(icon)
- zl.blit(pr1, (0, 0))
- zl1.blit(pr2, (0, 0))
- zl2.blit(prall, (0, 0))
- player.blit(img, (0, 0))
- screen.blit(player, (x1, y1))
- screen.blit(zl, (z_x, z_y))
- screen.blit(zl1, (z_x1, z_y1))
- screen.blit(zl2, (z_x2, z_y2))
- window.blit(screen, (0, 0))
- pygame.display.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement