Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. import pygame
  2. from pygame.locals import *
  3. pygame.init()
  4.  
  5.  
  6. fenetre = pygame.display.set_mode((1500, 1000))
  7. pygame.display.set_caption("Jeu")
  8. fond = pygame.image.load("Pierre2.jpg").convert()
  9. perso = pygame.image.load("Perso.png").convert_alpha()
  10.  
  11.  
  12.  
  13.  
  14. def placeperso (x,y,image) :
  15. fenetre.blit(image, (x,y))
  16.  
  17. def principale() :
  18. x = 720
  19. y = 470
  20. y_mouvement = 0
  21.  
  22. fermer = False
  23.  
  24. while not fermer :
  25. for event in pygame.event.get() :
  26. if event.type == pygame.QUIT :
  27. fermer = True
  28.  
  29. if event.type == pygame.KEYDOWN :
  30. if event.key == pygame.K_UP :
  31. y_mouvement = -10
  32. if event.key == pygame.KEYUP :
  33. y_mouvement = 0
  34.  
  35. y+= y_mouvement
  36.  
  37. fenetre.blit(fond,(0,0))
  38. placeperso(x,y,perso)
  39. pygame.display.update()
  40.  
  41. principale()
  42. pygame.quit()
  43. quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement