Dialogues (fais pas chier j'ai trop mal a la tête pour faire une bonne PR) #62
8
assets/dialogs/search.json
Normal file
8
assets/dialogs/search.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[
|
||||||
|
"Alors, où te cache tu ???",
|
||||||
|
"Je vais te trouver !",
|
||||||
|
"Ou te cache tu ?",
|
||||||
|
"Mais t'es où enfin !",
|
||||||
|
"Comment cet idiot fait pour aussi bien se cacher ?",
|
||||||
|
"Montre toi..."
|
||||||
|
]
|
|
@ -21,7 +21,7 @@ import pyttsx3
|
||||||
engine = pyttsx3.init()
|
engine = pyttsx3.init()
|
||||||
|
|
||||||
|
|
||||||
def spawn_dialog(world: World, name: str, height: float = 900):
|
def spawn_dialog(world: World, name: str, index: int = -1, height: float = 100):
|
||||||
"""
|
"""
|
||||||
Fait apparaitre un dialogue dans le monde.
|
Fait apparaitre un dialogue dans le monde.
|
||||||
"""
|
"""
|
||||||
|
@ -29,7 +29,7 @@ def spawn_dialog(world: World, name: str, height: float = 900):
|
||||||
texts: list[str] = json.load(
|
texts: list[str] = json.load(
|
||||||
open(f"assets/dialogs/{name}.json", "r", encoding="utf-8")
|
open(f"assets/dialogs/{name}.json", "r", encoding="utf-8")
|
||||||
)
|
)
|
||||||
text = random.choice(texts)
|
text = random.choice(texts) if index == -1 else texts[index]
|
||||||
# engine.say(text)
|
# engine.say(text)
|
||||||
engine.save_to_file(text, "voice.mp3")
|
engine.save_to_file(text, "voice.mp3")
|
||||||
engine.runAndWait()
|
engine.runAndWait()
|
||||||
|
|
|
@ -177,9 +177,13 @@ def __game_loop(world: World):
|
||||||
La boucle principale de la scène
|
La boucle principale de la scène
|
||||||
"""
|
"""
|
||||||
yield wait(5.0)
|
yield wait(5.0)
|
||||||
|
dialog_index = 0
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
if i % 2 == 1:
|
if i % 2 == 1:
|
||||||
__block_directory(world)
|
__block_directory(world)
|
||||||
|
if i in (0, 1, 2, 4, 6, 8):
|
||||||
|
dialog.spawn_dialog(world, "search", dialog_index)
|
||||||
|
dialog_index += 1
|
||||||
__spawn_search_alerts(world, int(i / 1.5) + 1)
|
__spawn_search_alerts(world, int(i / 1.5) + 1)
|
||||||
yield wait(5.0 - (i * 0.4))
|
yield wait(5.0 - (i * 0.4))
|
||||||
__spawn_search_directory(world)
|
__spawn_search_directory(world)
|
||||||
|
|
Loading…
Reference in a new issue