-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshot.py
More file actions
21 lines (15 loc) · 686 Bytes
/
shot.py
File metadata and controls
21 lines (15 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import pygame
from circleshape import *
from constants import *
class Shot(CircleShape):
def __init__(self, x, y, radius):
super().__init__(x, y, radius)
surface_size = int(self.radius * 2) # Make it a bit bigger than needed
self.image = pygame.Surface((surface_size, surface_size), pygame.SRCALPHA)
self.rect = self.image.get_rect(center=(x, y))
pygame.draw.circle(self.image, "white", (radius, radius), radius, 2)
def draw(self, screen):
pygame.draw.circle(screen, "white", self.position, self.radius, 2)
def update(self, dt):
self.position += self.velocity * dt
self.rect.center = self.position