blob: ab7b9a4e7c49e9ce96da1f9df0474eeb0b84e42b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import pygame
class Laser(pygame.sprite.Sprite):
def __init__(self, position: tuple, geschwindigkeit: float):
super().__init__()
self.image = pygame.Surface((3,10))
self.image.fill((255,255,255)) # Farbe
self.rect = self.image.get_rect()
self.rect.center = position
self.__pos_y = float(self.rect.y)
self.__geschwindigkeit = float(geschwindigkeit)
def getRect(self):
return self.rect
def bewegen(self, dt: float):
self.__pos_y += self.__geschwindigkeit * dt
self.rect.y = int(round(self.__pos_y))
|