Ajout d'une mechanique de dossier bloqués, et de nouvelles animations #52
BIN
assets/krita/loupeA.kra
Normal file
BIN
assets/krita/tous les dossiers et animation.kra
Normal file
BIN
assets/sounds/block.wav
Normal file
BIN
assets/sounds/skweak1.ogg
Normal file
BIN
assets/textures/animations/attack_point/despawn/0000.png
Normal file
After Width: | Height: | Size: 6 KiB |
BIN
assets/textures/animations/attack_point/despawn/0001.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
assets/textures/animations/attack_point/despawn/0002.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
assets/textures/animations/attack_point/despawn/0003.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
assets/textures/animations/attack_point/despawn/0004.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
assets/textures/animations/attack_point/despawn/0005.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
assets/textures/animations/attack_point/despawn/0006.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
assets/textures/animations/attack_point/despawn/0007.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
assets/textures/animations/attack_point/despawn/0008.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
assets/textures/animations/attack_point/despawn/0009.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
assets/textures/animations/attack_point/despawn/0010.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
assets/textures/animations/attack_point/despawn/0011.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
assets/textures/animations/attack_point/despawn/0012.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
assets/textures/animations/attack_point/despawn/0013.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
assets/textures/animations/attack_point/despawn/0014.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
assets/textures/animations/attack_point/despawn/0015.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
assets/textures/animations/attack_point/despawn/0016.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
assets/textures/animations/attack_point/despawn/0017.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
assets/textures/animations/attack_point/despawn/0018.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/textures/animations/attack_point/despawn/0019.png
Normal file
After Width: | Height: | Size: 975 B |
BIN
assets/textures/animations/attack_point/despawn/0020.png
Normal file
After Width: | Height: | Size: 892 B |
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"end_image": "error.png",
|
||||||
|
"offset": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"frame_count": 21,
|
||||||
|
"fps": 60
|
||||||
|
}
|
BIN
assets/textures/animations/attack_point/spawn/0000.png
Normal file
After Width: | Height: | Size: 892 B |
BIN
assets/textures/animations/attack_point/spawn/0001.png
Normal file
After Width: | Height: | Size: 975 B |
BIN
assets/textures/animations/attack_point/spawn/0002.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/textures/animations/attack_point/spawn/0003.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
assets/textures/animations/attack_point/spawn/0004.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
assets/textures/animations/attack_point/spawn/0005.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
assets/textures/animations/attack_point/spawn/0006.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
assets/textures/animations/attack_point/spawn/0007.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
assets/textures/animations/attack_point/spawn/0008.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
assets/textures/animations/attack_point/spawn/0009.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
assets/textures/animations/attack_point/spawn/0010.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
assets/textures/animations/attack_point/spawn/0011.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
assets/textures/animations/attack_point/spawn/0012.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
assets/textures/animations/attack_point/spawn/0013.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
assets/textures/animations/attack_point/spawn/0014.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
assets/textures/animations/attack_point/spawn/0015.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
assets/textures/animations/attack_point/spawn/0016.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
assets/textures/animations/attack_point/spawn/0017.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
assets/textures/animations/attack_point/spawn/0018.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
assets/textures/animations/attack_point/spawn/0019.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
assets/textures/animations/attack_point/spawn/0020.png
Normal file
After Width: | Height: | Size: 6 KiB |
9
assets/textures/animations/attack_point/spawn/info.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"end_image": "attack_point.png",
|
||||||
|
"offset": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"frame_count": 21,
|
||||||
|
"fps": 60
|
||||||
|
}
|
BIN
assets/textures/animations/blocked_to_directory/0000.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
assets/textures/animations/blocked_to_directory/0001.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
assets/textures/animations/blocked_to_directory/0002.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
assets/textures/animations/blocked_to_directory/0003.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
assets/textures/animations/blocked_to_directory/0004.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
assets/textures/animations/blocked_to_directory/0005.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
assets/textures/animations/blocked_to_directory/0006.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
assets/textures/animations/blocked_to_directory/0007.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
assets/textures/animations/blocked_to_directory/0008.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
assets/textures/animations/blocked_to_directory/0009.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
assets/textures/animations/blocked_to_directory/0010.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
assets/textures/animations/blocked_to_directory/0011.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
assets/textures/animations/blocked_to_directory/0012.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
assets/textures/animations/blocked_to_directory/0013.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
assets/textures/animations/blocked_to_directory/0014.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/textures/animations/blocked_to_directory/0015.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/textures/animations/blocked_to_directory/0016.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/textures/animations/blocked_to_directory/0017.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
assets/textures/animations/blocked_to_directory/0018.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/textures/animations/blocked_to_directory/0019.png
Normal file
After Width: | Height: | Size: 4 KiB |
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"end_image": "directory.png",
|
||||||
|
"offset": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"frame_count": 20,
|
||||||
|
"fps": 60
|
||||||
|
}
|
BIN
assets/textures/animations/directory_to_blocked/0000.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
assets/textures/animations/directory_to_blocked/0001.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/textures/animations/directory_to_blocked/0002.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
assets/textures/animations/directory_to_blocked/0003.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
assets/textures/animations/directory_to_blocked/0004.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
assets/textures/animations/directory_to_blocked/0005.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
assets/textures/animations/directory_to_blocked/0006.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
assets/textures/animations/directory_to_blocked/0007.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
assets/textures/animations/directory_to_blocked/0008.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
assets/textures/animations/directory_to_blocked/0009.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
assets/textures/animations/directory_to_blocked/0010.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
assets/textures/animations/directory_to_blocked/0011.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
assets/textures/animations/directory_to_blocked/0012.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
assets/textures/animations/directory_to_blocked/0013.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
assets/textures/animations/directory_to_blocked/0014.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
assets/textures/animations/directory_to_blocked/0015.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
assets/textures/animations/directory_to_blocked/0016.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
assets/textures/animations/directory_to_blocked/0017.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
assets/textures/animations/directory_to_blocked/0018.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
assets/textures/animations/directory_to_blocked/0019.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"end_image": "blocked_directory.png",
|
||||||
|
"offset": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"frame_count": 20,
|
||||||
|
"fps": 60
|
||||||
|
}
|
BIN
assets/textures/blocked_directory.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
|
@ -107,6 +107,12 @@ class UserDirectory:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class BlockedDirectory:
|
||||||
|
"""
|
||||||
|
Un component qui permet de savoir que le dossier est bloqué.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class GameStarted:
|
class GameStarted:
|
||||||
"""
|
"""
|
||||||
Une ressource qui permet de savoir que le jeu commence.
|
Une ressource qui permet de savoir que le jeu commence.
|
||||||
|
@ -231,24 +237,68 @@ def __attacks(world: World):
|
||||||
else:
|
else:
|
||||||
directory_entity[Animation] = Animation("search_directory")
|
directory_entity[Animation] = Animation("search_directory")
|
||||||
del entity[AttackPoint]
|
del entity[AttackPoint]
|
||||||
del entity[Position]
|
|
||||||
del entity[Order]
|
def del_anim_entity(_: World, entity: Entity):
|
||||||
del entity[Centered]
|
del entity[Animation]
|
||||||
del entity[Texture]
|
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:
|
elif timer >= world[AttackSpeed] + 4.5 and world[State] == State.SEARCHING:
|
||||||
world[State] = State.MOVING
|
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):
|
for _ in range(10):
|
||||||
position = AttackPoint(
|
x = random.randint(0, COLUMNS - 1)
|
||||||
random.randint(0, COLUMNS - 1),
|
y = random.randint(0, LINES - 1)
|
||||||
random.randint(0, LINES - 1),
|
position = AttackPoint(x, y)
|
||||||
)
|
|
||||||
world.create_entity(
|
# On verifie que l'entité n'est pas bloquée
|
||||||
position,
|
is_on_blocked_directory = False
|
||||||
Position(position.screen_position()),
|
for entity in world.query(BlockedDirectory, DirectoryPosition):
|
||||||
Order(50),
|
if (
|
||||||
Centered(),
|
entity[DirectoryPosition].screen_position()
|
||||||
Texture("attack_point.png"),
|
== 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[AttackTimer] = AttackTimer(0.0)
|
||||||
world[AttackSpeed] = AttackSpeed(world[AttackSpeed] * 0.9)
|
world[AttackSpeed] = AttackSpeed(world[AttackSpeed] * 0.9)
|
||||||
|
|
||||||
|
@ -281,6 +331,11 @@ def __move_directories(world: World):
|
||||||
del world[SelectedDirectory]
|
del world[SelectedDirectory]
|
||||||
return
|
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
|
# On calcule le déplacement de la souris
|
||||||
mouse_delta = mouse.position - selected_directory.position
|
mouse_delta = mouse.position - selected_directory.position
|
||||||
|
|
||||||
|
@ -323,8 +378,13 @@ def __move_directories(world: World):
|
||||||
directory_position.x + movement[0],
|
directory_position.x + movement[0],
|
||||||
directory_position.y + movement[1],
|
directory_position.y + movement[1],
|
||||||
):
|
):
|
||||||
other_directory = entity
|
if BlockedDirectory not in entity:
|
||||||
break
|
other_directory = entity
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
world.create_entity(Sound("block.wav"))
|
||||||
|
del entity[SelectedDirectory]
|
||||||
|
del world[SelectedDirectory]
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -337,7 +397,7 @@ def __move_directories(world: World):
|
||||||
selected_entity[DirectoryPosition].y += movement[1]
|
selected_entity[DirectoryPosition].y += movement[1]
|
||||||
|
|
||||||
# On joue un son
|
# On joue un son
|
||||||
world.create_entity(Sound("slide.wav"))
|
world.create_entity(Sound("slide.wav", 1))
|
||||||
|
|
||||||
# On retire le dossier selectionné
|
# On retire le dossier selectionné
|
||||||
del world[SelectedDirectory]
|
del world[SelectedDirectory]
|
||||||
|
|