Guest User

Untitled

a guest
Jul 17th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import pygame, functions
  2. from pygame.locals import *
  3.  
  4. RESOLUTION = (256, 240)
  5. SCALE = 2
  6.  
  7. class Player(pygame.sprite.Sprite):
  8. def __init__(self):
  9. pygame.sprite.Sprite.__init__(self)
  10. self.image, self.rect = functions.load_image('player.bmp')
  11. self.rect.center = ([x/2 for x in RESOLUTION])
  12.  
  13. pygame.init()
  14. clock = pygame.time.Clock()
  15.  
  16. screen = pygame.display.set_mode((
  17. int(RESOLUTION[0]*SCALE),
  18. int(RESOLUTION[1]*SCALE)))
  19. surface = pygame.Surface(RESOLUTION)
  20. surface = pygame.transform.scale(surface,
  21. (int(RESOLUTION[0]*SCALE),
  22. int(RESOLUTION[1]*SCALE)))
  23. screen.blit(surface, (0, 0))
  24. sprites = pygame.sprite.RenderPlain(Player())
  25.  
  26. while True:
  27. clock.tick(60)
  28. sprites.update()
  29. sprites.draw(surface)
  30. pygame.display.flip()
Add Comment
Please, Sign In to add comment