Compare commits

...

19 Commits

Author SHA1 Message Date
6c0ef9b711 main.py aktualisiert 2025-07-03 11:03:20 +02:00
55cc9b8e3f main.py aktualisiert 2025-07-03 10:59:20 +02:00
3a4f579f05 main.py aktualisiert 2025-07-03 10:44:54 +02:00
e8366a9ab4 main.py aktualisiert 2025-07-03 10:41:02 +02:00
79e84b9fe4 Dateien nach "images" hochladen 2025-07-03 09:38:07 +02:00
186f0c2d3f Dateien nach "images" hochladen 2025-07-03 09:34:33 +02:00
52ec929c3f Dateien nach "images" hochladen 2025-07-03 09:19:30 +02:00
79d0e88f0d main.py aktualisiert 2025-07-02 14:58:15 +02:00
443f3ee05f revert e534678494
revert main.py aktualisiert
2025-07-02 14:23:04 +02:00
e534678494 main.py aktualisiert 2025-07-02 14:16:26 +02:00
4335aafdf8 Dateien nach "images" hochladen 2025-06-26 00:04:45 +02:00
bf94840bad images/tutorial.png/tutorial.png gelöscht 2025-06-26 00:04:13 +02:00
6d03cb6a38 Dateien nach "images/tutorial.png" hochladen 2025-06-26 00:03:39 +02:00
32924ae867 images/tutorial.png gelöscht 2025-06-26 00:02:44 +02:00
a22baf175a Dateien nach "images" hochladen 2025-06-26 00:02:20 +02:00
1370d7696e images/tutorial.png gelöscht 2025-06-26 00:01:32 +02:00
93308cbee1 test webhook 2025-05-04 22:26:09 +02:00
80ff81f57c final changes for better touch function 2025-05-04 14:09:22 +02:00
3e4c4442cf final changes for better touch function 2025-05-04 14:07:40 +02:00
2 changed files with 19 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 844 KiB

After

Width:  |  Height:  |  Size: 886 KiB

24
main.py
View File

@@ -4,6 +4,8 @@ import random
import sys
import os
import time
import re
random.seed(time.time())
from pygame import FULLSCREEN
@@ -100,7 +102,7 @@ def touch(event):
elif dy < -50 and abs(dx) < 80 and duration > 0.08:
return "ontop"
else:
print("touch problem")
print("touch probleeeeem")
return False
return False
@@ -523,8 +525,17 @@ def generate_fill_sequence():
global case_sequence
try:
with open("case_sequences.txt", "r") as f:
sets = f.read().strip().split("\n\n")
chosen = random.choice(sets).strip().split("\n")
sets = re.split(r"\r?\n\r?\n", f.read().strip())
print(f"Anzahl erkannter Sets: {len(sets)}")
index = random.randint(0, len(sets) - 1)
print(f"Zufällig gewählter Index: {index}")
chosen_raw = sets[index].strip()
print("Erste Zeilen des gewählten Sets:")
print("\n".join(chosen_raw.splitlines()[:3])) # Zeigt max. 3 Zeilen an
chosen = chosen_raw.split("\n")
sequence = []
for line in chosen:
parts = line.strip().split(",")
@@ -532,9 +543,12 @@ def generate_fill_sequence():
w, h, rot = int(parts[0]), int(parts[1]), parts[2].strip().lower() == 'true'
sequence.append({'w': w, 'h': h, 'rotated': rot})
case_sequence = sequence
except:
except Exception as e:
print("Fehler beim Laden der Sequenz:", e)
case_sequence = [{'w': 2, 'h': 1, 'rotated': False}, {'w': 1, 'h': 2, 'rotated': False}]
def spawn_case_in_game():
global current_case, next_queue, case_index
if not case_sequence:
@@ -638,7 +652,7 @@ async def show_game_over(score):
overlay.fill((0, 0, 0))
screen.blit(overlay, (0, 0))
font_big = pygame.font.SysFont(None, 72)
message = f"Spiel beendet! Punkte: {int(score)}%"
message = f"Spiel beendet! Punkte: {int(score)}%. Drücke die Leertaste um deine Punkte zu übermitteln."
text = font_big.render(message, True, (255, 255, 255))
screen.blit(text, (SCREEN_WIDTH // 2 - text.get_width() // 2, SCREEN_HEIGHT // 2 - text.get_height() // 2))
pygame.display.flip()