Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- import random
- class Main():
- def __init__(self, resolution):
- self.resolution = resolution
- resolution = (640, 480)
- self.screen = pygame.display.set_mode(resolution)
- self.stage = pygame.display.set_mode(resolution)
- self.spawn = (random.randint(0, (resolution[0] - 32)), random.randint(0, resolution[1] - 32))
- self.coin = pygame.image.load('Coin.png')
- self.background = pygame.image.load('BG.png')
- def drawing(self):
- self.screen.blit(self.background, (0, 0))
- self.stage.blit(self.coin, self.spawn)
- running = True
- while running:
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- running = False
- if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
- running = False
- drawing()
- pygame.display.update()
- window1 = Main((1200, 900))
- if __name__ == '__Main__':
- pygame.init()
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement