use black mask instead of alpha

This commit is contained in:
Patrick Moessler 2023-02-17 02:05:54 +01:00
parent e2c8638217
commit 95f3e6c845

View file

@ -1,6 +1,6 @@
from typing import Any
import pygame as pg
from effects.effect import Effect
from effects.effect import Effect, Colors
import random
import math
from typing import Union, Generator
@ -30,7 +30,9 @@ class BouncingSpot(Effect):
size = (math.sin(self.ticks) / 2 + 0.5) * (
self.max_size - self.min_size
) + self.min_size
image = pg.Surface((self.max_size, self.max_size), flags=pg.SRCALPHA, depth=32)
image = pg.Surface((self.max_size, self.max_size))
image.fill(Colors.Black)
image.set_colorkey(Colors.Black)
super().__init__(
image=image,
rect=pg.Rect(
@ -60,7 +62,7 @@ class BouncingSpot(Effect):
+ self.bounds.centery
)
self.image.fill(pg.Color(255, 255, 0, 0))
self.image.fill(Colors.Black)
pg.draw.ellipse(
self.image,
self.color if isinstance(self.color, pg.Color) else next(self.color),