use black mask instead of alpha
This commit is contained in:
parent
e2c8638217
commit
95f3e6c845
1 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
import pygame as pg
|
import pygame as pg
|
||||||
from effects.effect import Effect
|
from effects.effect import Effect, Colors
|
||||||
import random
|
import random
|
||||||
import math
|
import math
|
||||||
from typing import Union, Generator
|
from typing import Union, Generator
|
||||||
|
@ -30,7 +30,9 @@ class BouncingSpot(Effect):
|
||||||
size = (math.sin(self.ticks) / 2 + 0.5) * (
|
size = (math.sin(self.ticks) / 2 + 0.5) * (
|
||||||
self.max_size - self.min_size
|
self.max_size - self.min_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__(
|
super().__init__(
|
||||||
image=image,
|
image=image,
|
||||||
rect=pg.Rect(
|
rect=pg.Rect(
|
||||||
|
@ -60,7 +62,7 @@ class BouncingSpot(Effect):
|
||||||
+ self.bounds.centery
|
+ self.bounds.centery
|
||||||
)
|
)
|
||||||
|
|
||||||
self.image.fill(pg.Color(255, 255, 0, 0))
|
self.image.fill(Colors.Black)
|
||||||
pg.draw.ellipse(
|
pg.draw.ellipse(
|
||||||
self.image,
|
self.image,
|
||||||
self.color if isinstance(self.color, pg.Color) else next(self.color),
|
self.color if isinstance(self.color, pg.Color) else next(self.color),
|
||||||
|
|
Loading…
Reference in a new issue