- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
import pygame
window = pygame.display.set_mode((600, 600))
pygame.display.set_caption("GAME")
screen = pygame.Surface((600, 600))
class Sprite:
def __init__(self, xpos, ypos, filename):
self.x=xpos
self.y=ypos
self.bitmap=pygame.image.load(filename)
self.bitmap.set_colorkey((0,0,0))
def render(self):
screen.blit(self.bitmap, (self.x,self.y))
laser = Sprite(0, 0, 'laser.png')
done = True
while done:
window.fill((50,50,50))
for e in pygame.event.get():
if e.type == pygame.QUIT:
done = False
screen.fill((50,50,50))
laser.render()
window.blit(screen, (0,0))
pygame.display.flip()