-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDot.py
28 lines (21 loc) · 800 Bytes
/
Dot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pygame
pygame.init()
class Dot(pygame.sprite.Sprite):
def __init__(self, window: pygame.Surface, x, y, opacity, size) -> None:
self.x = x
self.y = y
self.opacity = opacity
self.size = size
self.window = window
self.velocity = pygame.Vector2(0, 0)
self.image = pygame.image.load("data/dot.png")
self.image.convert()
self.image.convert_alpha()
self.image.set_colorkey((0, 0, 0))
self.image.set_alpha(opacity)
self.image = pygame.transform.scale(self.image, (self.size, self.size))
def move(self):
self.x += self.velocity.x
self.y += self.velocity.y
def render(self):
self.window.blit(self.image, (self.x, self.y))