Gameplay de la recherche dans les dossiers #44
|
@ -106,6 +106,30 @@ class UserDirectory:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class GameStarted:
|
||||||
|
"""
|
||||||
|
Une ressource qui permet de savoir que le jeu commence.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def __change_folders_speeds(world: World, _e: Entity):
|
||||||
|
"""
|
||||||
|
Change les vitesses des dossiers.
|
||||||
|
"""
|
||||||
|
for entity in world.query(DirectoryPosition, smooth.Speed):
|
||||||
|
entity[smooth.Speed] = smooth.Speed(random.uniform(2.0, 2.5))
|
||||||
|
|
||||||
|
|
||||||
|
def __remove_folders_speeds(world: World):
|
||||||
|
"""
|
||||||
|
Supprime les vitesses des dossiers.
|
||||||
|
"""
|
||||||
|
if GameStarted not in world and world[AttackTimer] >= 3.0:
|
||||||
|
for entity in world.query(DirectoryPosition, smooth.Speed):
|
||||||
|
del entity[smooth.Speed]
|
||||||
|
world[GameStarted] = GameStarted()
|
||||||
|
|
||||||
|
|
||||||
def __initialize_world(world: World):
|
def __initialize_world(world: World):
|
||||||
"""
|
"""
|
||||||
Initialise le monde de la scène.
|
Initialise le monde de la scène.
|
||||||
|
@ -117,7 +141,7 @@ def __initialize_world(world: World):
|
||||||
world.create_entity(
|
world.create_entity(
|
||||||
Position(),
|
Position(),
|
||||||
Order(0),
|
Order(0),
|
||||||
Animation("fade_desktop"),
|
Animation("fade_desktop", __change_folders_speeds),
|
||||||
)
|
)
|
||||||
|
|
||||||
names = [
|
names = [
|
||||||
|
@ -137,11 +161,31 @@ def __initialize_world(world: World):
|
||||||
"Films",
|
"Films",
|
||||||
"Cinéma",
|
"Cinéma",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
positions = [
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
Position(0, 0),
|
||||||
|
]
|
||||||
|
|
||||||
for y in range(LINES):
|
for y in range(LINES):
|
||||||
for x in range(COLUMNS):
|
for x in range(COLUMNS):
|
||||||
position = DirectoryPosition(x, y)
|
position = DirectoryPosition(x, y)
|
||||||
entity = world.create_entity(
|
entity = world.create_entity(
|
||||||
Position(position.screen_position()),
|
positions.pop(),
|
||||||
|
smooth.Speed(0),
|
||||||
Order(1),
|
Order(1),
|
||||||
Centered(),
|
Centered(),
|
||||||
Texture("directory.png"),
|
Texture("directory.png"),
|
||||||
|
@ -211,7 +255,7 @@ def __move_directories(world: World):
|
||||||
Permet de déplacer les dossiers avec la souris.
|
Permet de déplacer les dossiers avec la souris.
|
||||||
"""
|
"""
|
||||||
# Si on n'est pas dans le bon state on annule
|
# Si on n'est pas dans le bon state on annule
|
||||||
if world[State] == State.GAME_OVER:
|
if GameStarted not in world or world[State] == State.GAME_OVER:
|
||||||
return
|
return
|
||||||
|
|
||||||
# On met à jour la séléction
|
# On met à jour la séléction
|
||||||
|
@ -314,7 +358,7 @@ def __update_directory_names(world: World):
|
||||||
SCENE = (
|
SCENE = (
|
||||||
Scene(
|
Scene(
|
||||||
[__initialize_world],
|
[__initialize_world],
|
||||||
[__attacks, __move_directories, __update_positions],
|
[__attacks, __move_directories, __update_positions, __remove_folders_speeds],
|
||||||
[],
|
[],
|
||||||
)
|
)
|
||||||
+ smooth.PLUGIN
|
+ smooth.PLUGIN
|
||||||
|
|
Loading…
Reference in a new issue