Bonus focntionnel
BIN
assets/textures/big.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 133 KiB |
Before Width: | Height: | Size: 121 KiB |
Before Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 88 KiB |
Before Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB |
BIN
assets/textures/fast.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
assets/textures/multi.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
assets/textures/reverse.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
|
@ -16,6 +16,7 @@ from plugins.render import (
|
||||||
TextBundle,
|
TextBundle,
|
||||||
Text,
|
Text,
|
||||||
TextSize,
|
TextSize,
|
||||||
|
Texture,
|
||||||
)
|
)
|
||||||
from plugins.timing import Delta, Time
|
from plugins.timing import Delta, Time
|
||||||
import random
|
import random
|
||||||
|
@ -151,7 +152,7 @@ class HasBonus:
|
||||||
case Bonus.BIG:
|
case Bonus.BIG:
|
||||||
entity[Scale] /= 2
|
entity[Scale] /= 2
|
||||||
case Bonus.FAST:
|
case Bonus.FAST:
|
||||||
entity[Speed] /= 2
|
entity[Speed] /= 1.5
|
||||||
case Bonus.REVERSE:
|
case Bonus.REVERSE:
|
||||||
entity[UpKey], entity[DownKey] = entity[DownKey], entity[UpKey]
|
entity[UpKey], entity[DownKey] = entity[DownKey], entity[UpKey]
|
||||||
|
|
||||||
|
@ -175,6 +176,18 @@ class Bonus(Enum):
|
||||||
case _:
|
case _:
|
||||||
return Bonus.REVERSE
|
return Bonus.REVERSE
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_texture(bonus: "Bonus"):
|
||||||
|
match bonus:
|
||||||
|
case Bonus.MULTI:
|
||||||
|
return "multi.png"
|
||||||
|
case Bonus.BIG:
|
||||||
|
return "big.png"
|
||||||
|
case Bonus.FAST:
|
||||||
|
return "fast.png"
|
||||||
|
case _:
|
||||||
|
return "reverse.png"
|
||||||
|
|
||||||
|
|
||||||
def __spawn_ellements(world: World):
|
def __spawn_ellements(world: World):
|
||||||
"""
|
"""
|
||||||
|
@ -274,19 +287,20 @@ def __spawn_ellements(world: World):
|
||||||
|
|
||||||
|
|
||||||
def __spawn_bonus(world: World):
|
def __spawn_bonus(world: World):
|
||||||
|
bonus = Bonus.aleatoire()
|
||||||
world.new_entity().set(
|
world.new_entity().set(
|
||||||
SpriteBundle(
|
SpriteBundle(
|
||||||
"player_1.png",
|
Bonus.get_texture(bonus),
|
||||||
3,
|
3,
|
||||||
Vec2(
|
Vec2(
|
||||||
random.randint(200, render.WIDTH - 200),
|
random.randint(200, render.WIDTH - 200),
|
||||||
random.randint(100, render.HEIGHT - 100),
|
random.randint(100, render.HEIGHT - 100),
|
||||||
),
|
),
|
||||||
Vec2(100),
|
Vec2(70),
|
||||||
Vec2(0.5),
|
Vec2(0.5),
|
||||||
),
|
),
|
||||||
physics.Solid(),
|
physics.Solid(),
|
||||||
Bonus.aleatoire(),
|
bonus,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -341,7 +355,7 @@ def __bonus_touched(ball: Entity, bonus: Entity):
|
||||||
player[Scale] *= 2
|
player[Scale] *= 2
|
||||||
player.set(HasBonus(Bonus.BIG, 10, bonus.world))
|
player.set(HasBonus(Bonus.BIG, 10, bonus.world))
|
||||||
case Bonus.FAST:
|
case Bonus.FAST:
|
||||||
player[Speed] *= 2
|
player[Speed] *= 1.5
|
||||||
player.set(HasBonus(Bonus.FAST, 10, bonus.world))
|
player.set(HasBonus(Bonus.FAST, 10, bonus.world))
|
||||||
case Bonus.REVERSE:
|
case Bonus.REVERSE:
|
||||||
for entity in ball.world.query(UpKey):
|
for entity in ball.world.query(UpKey):
|
||||||
|
|