Ajout d'une mechanique de dossier bloqués, et de nouvelles animations #52

Merged
tipragot merged 12 commits from blocked-diractories into main 2023-10-30 21:16:03 +00:00
96 changed files with 114 additions and 18 deletions

BIN
assets/krita/loupeA.kra Normal file

Binary file not shown.

Binary file not shown.

BIN
assets/sounds/block.wav Normal file

Binary file not shown.

BIN
assets/sounds/skweak1.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 892 B

View file

@ -0,0 +1,9 @@
{
"end_image": "error.png",
"offset": {
"x": 0,
"y": 0
},
"frame_count": 21,
"fps": 60
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

View file

@ -0,0 +1,9 @@
{
"end_image": "attack_point.png",
"offset": {
"x": 0,
"y": 0
},
"frame_count": 21,
"fps": 60
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -0,0 +1,9 @@
{
"end_image": "directory.png",
"offset": {
"x": 0,
"y": 0
},
"frame_count": 20,
"fps": 60
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

@ -0,0 +1,9 @@
{
"end_image": "blocked_directory.png",
"offset": {
"x": 0,
"y": 0
},
"frame_count": 20,
"fps": 60
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View file

@ -107,6 +107,12 @@ class UserDirectory:
"""
class BlockedDirectory:
"""
Un component qui permet de savoir que le dossier est bloqué.
"""
class GameStarted:
"""
Une ressource qui permet de savoir que le jeu commence.
@ -231,24 +237,68 @@ def __attacks(world: World):
else:
directory_entity[Animation] = Animation("search_directory")
del entity[AttackPoint]
del entity[Position]
del entity[Order]
del entity[Centered]
del entity[Texture]
def del_anim_entity(_: World, entity: Entity):
del entity[Animation]
del entity[Position]
del entity[Order]
del entity[Centered]
entity[Animation] = Animation(
"attack_point/despawn",
callback=del_anim_entity,
)
elif timer >= world[AttackSpeed] + 4.5 and world[State] == State.SEARCHING:
world[State] = State.MOVING
# on suprime les dossiers bloqués
for entity in world.query(BlockedDirectory):
del entity[BlockedDirectory]
del entity[Texture]
entity[Animation] = Animation("blocked_to_directory")
# On definit les directories comme bloques
for _ in range(3):
x = random.randint(0, COLUMNS - 1)
y = random.randint(0, LINES - 1)
position = DirectoryPosition(x, y)
for entity in world.query(
DirectoryPosition, Texture, without=[UserDirectory]
):
if (
entity[DirectoryPosition].screen_position()
== position.screen_position()
):
entity[BlockedDirectory] = BlockedDirectory()
del entity[Texture]
entity[Animation] = Animation("directory_to_blocked")
for _ in range(10):
position = AttackPoint(
random.randint(0, COLUMNS - 1),
random.randint(0, LINES - 1),
)
world.create_entity(
position,
Position(position.screen_position()),
Order(50),
Centered(),
Texture("attack_point.png"),
)
x = random.randint(0, COLUMNS - 1)
y = random.randint(0, LINES - 1)
position = AttackPoint(x, y)
# On verifie que l'entité n'est pas bloquée
is_on_blocked_directory = False
for entity in world.query(BlockedDirectory, DirectoryPosition):
if (
entity[DirectoryPosition].screen_position()
== position.screen_position()
):
is_on_blocked_directory = True
break
if not is_on_blocked_directory:
world.create_entity(
position,
Position(position.screen_position()),
Order(50),
Centered(),
Animation("attack_point/spawn"),
)
world[AttackTimer] = AttackTimer(0.0)
world[AttackSpeed] = AttackSpeed(world[AttackSpeed] * 0.9)
@ -281,6 +331,11 @@ def __move_directories(world: World):
del world[SelectedDirectory]
return
# On annule si le dossier selectionne est bloqué
if BlockedDirectory in selected_entity:
del world[SelectedDirectory]
return
# On calcule le déplacement de la souris
mouse_delta = mouse.position - selected_directory.position
@ -323,8 +378,13 @@ def __move_directories(world: World):
directory_position.x + movement[0],
directory_position.y + movement[1],
):
other_directory = entity
break
if BlockedDirectory not in entity:
other_directory = entity
break
else:
world.create_entity(Sound("block.wav"))
del entity[SelectedDirectory]
del world[SelectedDirectory]
else:
return
@ -337,7 +397,7 @@ def __move_directories(world: World):
selected_entity[DirectoryPosition].y += movement[1]
# On joue un son
world.create_entity(Sound("slide.wav"))
world.create_entity(Sound("slide.wav", 1))
# On retire le dossier selectionné
del world[SelectedDirectory]