Nouveaux bouons + ajouts commentaires

This commit is contained in:
Raphaël 2024-01-07 02:09:19 +01:00
parent 8c6e5c55fa
commit f95c89f628
20 changed files with 19 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View file

@ -202,6 +202,7 @@ def __spawn_elements(world: World):
# Initialisation des scores
world.set(Player1Score(0), Player2Score(0))
# Creation du texte d'affichage en fonction du mode de jeu
if world[GameMode] == GameMode.TWO:
world.new_entity().set(
TextBundle(
@ -257,6 +258,7 @@ def __bounce_on_player(a: Entity, b: Entity):
"""
Fonction qui decrit se qui se passe lorque la ball entre en collision avec un joueur
"""
# Si l'objet rencontré est un joueur
if Player1 in b or Player2 in b:
speed = a[physics.Velocity].length
a[physics.Velocity] = a[physics.Velocity].normalized
@ -264,16 +266,23 @@ def __bounce_on_player(a: Entity, b: Entity):
a[physics.Velocity] = a[physics.Velocity].normalized * min(
(speed * 1.1), 1000.0
)
# Si il s'agit du joueur 1 et que l'on est dans le mode 1 joueur
if Player1 in b and Ball in a:
if b.world[GameMode] == GameMode.ONE:
# Modification du score
a.world[Player1Score] += 100
__update_scores(a.world, b)
return True
def __bounce_on_top_or_bot_wall(a: Entity, b: Entity):
# Si une balle touceh un mur du haut ou du bas et que l'on est dans le mode 1 joueur
# Il est important de verifier qu'il s'agit de la balle,
# Car des simulation de balle sont faites et ont le meme
# Comportment qu'une balle mais n'ont pas le composant Ball
if Ball in b and Wall in a:
if b.world[GameMode] == GameMode.ONE:
# Modification du score
a.world[Player1Score] += 20
__update_scores(a.world, a)
return True
@ -312,7 +321,7 @@ def __bounce_on_right_wall(a: Entity, b: Entity):
def __move_up(world: World):
"""
La fonction permet de faire bouger les entitees vers le haut.
La fonction permet de faire bouger les entitees qui possedent UpKey vers le haut.
"""
held = world[Held]
for entity in world.query(UpKey):
@ -325,7 +334,7 @@ def __move_up(world: World):
def __move_down(world: World):
"""
La fonction permet de faire bouger les entitees vers le bas.
La fonction permet de faire bouger les entitees qui possedent DownKey vers le bas.
"""
held = world[Held]
for entity in world.query(DownKey):

View file

@ -36,7 +36,7 @@ def __spawn_elements(world: World):
origin=Vec2(0.5),
)
)
button_name = ["one_player", "two_player"]
button_name = ["yes", "no"]
for i, name in enumerate(button_name):
__create_button(world, i, name)
@ -65,9 +65,9 @@ def __on_click_butons(world: World, _entity: Entity, name: str):
Fonction qui s'execute quand on clique sur un bouton.
"""
match name:
case "one_player":
case "yes":
world[CurrentScene] = send_to_server.SEND
case "two_player":
case "no":
world[CurrentScene] = try_again.TRY_AGAIN
case _:
pass

View file

@ -76,8 +76,8 @@ def __spawn_elements(world: World):
origin=Vec2(0.5),
),
HoveredTexture(
f"button_one_player.png",
f"button_one_player_hover.png",
f"button_submit.png",
f"button_submit_hover.png",
),
Clickable(new_score),
)

View file

@ -38,9 +38,9 @@ def __on_click_butons(world: World, _entity: Entity, name: str):
Fonction qui s'execute quand on clique sur un bouton.
"""
match name:
case "one_player":
case "yes":
world[CurrentScene] = menu.MENU
case "two_player":
case "no":
world[CurrentScene] = game.ONE_PLAYER
case _:
pass
@ -61,7 +61,7 @@ def __spawn_elements(world: World):
origin=Vec2(0.5),
),
)
scenes_name = ["one_player", "two_player"]
scenes_name = ["yes", "no"]
for i, name in enumerate(scenes_name):
__create_button(world, i, name)