Gameplay de la recherche dans les dossiers #44

Merged
CoCo_Sol merged 32 commits from directory-search into main 2023-10-30 00:49:00 +00:00
2 changed files with 9 additions and 6 deletions
Showing only changes of commit 793697ad50 - Show all commits

View file

@ -1,5 +1,4 @@
{
"end_image": "directory.png",
"offset": {
"x": 8,
"y": -83

View file

@ -162,8 +162,12 @@ def __attacks(world: World):
world[AttackTimer] = AttackTimer(world[AttackTimer] + world[Delta])
timer = world[AttackTimer]
if timer >= world[AttackSpeed] and world[State] == State.MOVING:
entities = world.query(AttackPoint)
if len(entities) > 0:
world[State] = State.SEARCHING
for entity in world.query(AttackPoint):
else:
world[State] = State.WAITING
for entity in entities:
position = entity[AttackPoint]
for directory_entity in world.query(DirectoryPosition):
if directory_entity[DirectoryPosition] == position:
@ -173,9 +177,9 @@ def __attacks(world: World):
del entity[Order]
del entity[Centered]
del entity[Texture]
elif timer >= world[AttackSpeed] + 4 and world[State] == State.SEARCHING:
elif timer >= world[AttackSpeed] + 4.5 and world[State] == State.SEARCHING:
world[State] = State.WAITING
elif timer >= world[AttackSpeed] + 5 and world[State] == State.WAITING:
elif timer >= world[AttackSpeed] + 7 and world[State] == State.WAITING:
world[State] = State.MOVING
for _ in range(10):
position = AttackPoint(
@ -187,7 +191,7 @@ def __attacks(world: World):
Position(position.screen_position(State.MOVING)),
Order(50),
Centered(),
Texture("loupe.png"),
Texture("attack_point.png"),
)
world[AttackTimer] = AttackTimer(0.0)
world[AttackSpeed] = AttackSpeed(world[AttackSpeed] * 0.9)