Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame, math, random
- pygame.init()
- clock = pygame.time.Clock()
- WIDTH = 800
- HEIGHT = 600
- screen = pygame.display.set_mode((WIDTH, HEIGHT))
- run = True
- playergroup = pygame.sprite.Group()
- ###################### CLASS PLAYER ######################
- class Player(pygame.sprite.Sprite):
- def __init__(self,x,y):
- pygame.sprite.Sprite.__init__(self)
- self.image = pygame.image.load('dot16.png').convert_alpha()
- self.rect = self.image.get_rect()
- self.rect.x = x
- self.rect.y = y
- def update(self):
- pass
- ###################### OBJECT CREATION ######################
- player = Player(WIDTH/2,HEIGHT/2)
- playergroup.add(player)
- ###################### MAIN LOOP ######################
- while run:
- playergroup.update()
- screen.fill((255,255,255))
- playergroup.draw(screen)
- clock.tick(30)
- pygame.display.update()
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- run = False
- pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement