From 96bb74d246483c603bafbf77b16a2059a50f3670 Mon Sep 17 00:00:00 2001 From: Tipragot Date: Fri, 3 Nov 2023 11:11:42 +0100 Subject: [PATCH] Add typing sounds --- src/plugins/writing.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/writing.py b/src/plugins/writing.py index 84ed3eb..104ca06 100644 --- a/src/plugins/writing.py +++ b/src/plugins/writing.py @@ -5,6 +5,7 @@ Definit un plugin qui crée un texte avec les touches frappées from engine import Scene, World from plugins.inputs import Pressed from plugins.text import Text +from scenes import CLICK_SOUND class Writing: @@ -31,6 +32,7 @@ def __update(world: World): for key in pressed: if key == "backspace": text.text = text.text[:-1] + world.new_entity().set(CLICK_SOUND) if key.startswith("["): # pavé numerique key = key[1] if key in writing.accepted_chars and ( @@ -40,6 +42,7 @@ def __update(world: World): text.text = key else: text.text += key + world.new_entity().set(CLICK_SOUND) if text.text == "": text.text = writing.base_text