Compare commits
19 Commits
41ce304a76
...
old
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c0ef9b711 | |||
| 55cc9b8e3f | |||
| 3a4f579f05 | |||
| e8366a9ab4 | |||
| 79e84b9fe4 | |||
| 186f0c2d3f | |||
| 52ec929c3f | |||
| 79d0e88f0d | |||
| 443f3ee05f | |||
| e534678494 | |||
| 4335aafdf8 | |||
| bf94840bad | |||
| 6d03cb6a38 | |||
| 32924ae867 | |||
| a22baf175a | |||
| 1370d7696e | |||
| 93308cbee1 | |||
| 80ff81f57c | |||
| 3e4c4442cf |
Binary file not shown.
|
Before Width: | Height: | Size: 844 KiB After Width: | Height: | Size: 886 KiB |
24
main.py
24
main.py
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user