From 3584f9c08a9776b51b4fca16e896b32e1d84c469 Mon Sep 17 00:00:00 2001 From: csd4ni3l Date: Sun, 19 Oct 2025 19:41:24 +0200 Subject: [PATCH] Add youtube video demo to README, fix LogicalGates having no texture, because no value, fix gate zoom scaling applying to non-label gates --- README.md | 3 ++ game/play.py | 97 +++++++++++++++++++++++++++------------------------- 2 files changed, 53 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 12ec1b8..a184065 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ Logical Signals is a game where you have to direct and change signals with logical gates to meet the end result. +Demo video: +[![Demo Video](https://img.youtube.com/vi/OPEPoMZabS4/hqdefault.jpg)](https://youtu.be/OPEPoMZabS4) + # How to play: - You can move gates by dragging their buttons (not the plus ones) - To create connections, click on the + buttons (left for input, right for output) diff --git a/game/play.py b/game/play.py index f700857..95bf978 100644 --- a/game/play.py +++ b/game/play.py @@ -17,6 +17,8 @@ class LogicalGate(arcade.Sprite): self.input: list[LogicalGate] = [] self.output: LogicalGate | None = None + self.calculate_value() + def calculate_value(self): if self.gate_type == "OUTPUT" and self.input: self.value = self.input[0].calculate_value() @@ -357,54 +359,55 @@ class Game(arcade.gui.UIView): gate: arcade.gui.UIInputText for gate in self.gates: - if scroll_y == 1: - gate.scale(1.1) - else: - gate.scale(1 / 1.1) + if gate.gate_type == "LABEL": + if scroll_y == 1: + gate.scale(1.1) + else: + gate.scale(1 / 1.1) - if gate.width < self.window.width / 18: - gate.doc.set_style( - 0, - len(gate.text), - dict(font_name="Roboto", font_size=7, color=gate._text_color), - ) - elif gate.width < self.window.width / 16: - gate.doc.set_style( - 0, - len(gate.text), - dict(font_name="Roboto", font_size=9, color=gate._text_color), - ) - elif gate.width < self.window.width / 14: - gate.doc.set_style( - 0, - len(gate.text), - dict(font_name="Roboto", font_size=11, color=gate._text_color), - ) - - elif gate.width < self.window.width / 12: - gate.doc.set_style( - 0, - len(gate.text), - dict(font_name="Roboto", font_size=13, color=gate._text_color), - ) - elif gate.width < self.window.width / 10: - gate.doc.set_style( - 0, - len(gate.text), - dict(font_name="Roboto", font_size=15, color=gate._text_color), - ) - elif gate.width < self.window.width / 8: - gate.doc.set_style( - 0, - len(gate.text), - dict(font_name="Roboto", font_size=17, color=gate._text_color), - ) - elif gate.width < self.window.width / 6: - gate.doc.set_style( - 0, - len(gate.text), - dict(font_name="Roboto", font_size=19, color=gate._text_color), - ) + if gate.width < self.window.width / 18: + gate.doc.set_style( + 0, + len(gate.text), + dict(font_name="Roboto", font_size=7, color=gate._text_color), + ) + elif gate.width < self.window.width / 16: + gate.doc.set_style( + 0, + len(gate.text), + dict(font_name="Roboto", font_size=9, color=gate._text_color), + ) + elif gate.width < self.window.width / 14: + gate.doc.set_style( + 0, + len(gate.text), + dict(font_name="Roboto", font_size=11, color=gate._text_color), + ) + + elif gate.width < self.window.width / 12: + gate.doc.set_style( + 0, + len(gate.text), + dict(font_name="Roboto", font_size=13, color=gate._text_color), + ) + elif gate.width < self.window.width / 10: + gate.doc.set_style( + 0, + len(gate.text), + dict(font_name="Roboto", font_size=15, color=gate._text_color), + ) + elif gate.width < self.window.width / 8: + gate.doc.set_style( + 0, + len(gate.text), + dict(font_name="Roboto", font_size=17, color=gate._text_color), + ) + elif gate.width < self.window.width / 6: + gate.doc.set_style( + 0, + len(gate.text), + dict(font_name="Roboto", font_size=19, color=gate._text_color), + ) def on_event(self, event): arcade.gui.UIManager.on_event(self.ui, event)