28.10.2026 Stundenende

This commit is contained in:
Aron Sommer
2026-10-28 11:01:35 +01:00
parent 266f3ae1bc
commit dedc08e9f4
3 changed files with 38 additions and 5 deletions
+31 -3
View File
@@ -1,6 +1,8 @@
import copy
import pygame
import random
import math
import time
class MeinSpiel:
@@ -26,7 +28,10 @@ class MeinSpiel:
self.spielfeld = []
self.spielfiguren = []
self.am_zug = 0
self.zufallswert = 0
self.animationsWerte = []
self.wuerfelBildAnzeigen = False
for x in range(felderX):
@@ -60,6 +65,16 @@ class MeinSpiel:
x, y = self.pfad[0]
self.spielfiguren[x][y].append(figur)
def animateWuerfel(self):
for n in range(20):
self.animationsWerte.append(random.randint(1, 6))
for i in range(20):
time.sleep(1)
self.wuerfelBildAnzeigen = i
self.wuerfelBildAnzeigen = True
def tasteGedrueckt(self, taste):
if taste != pygame.K_SPACE and taste != "mouseevent":
return
@@ -69,19 +84,32 @@ class MeinSpiel:
figur = self.am_zug
start = self.positionen[figur]
#print(f"start: {start}\nself.zufallswert: {self.zufallswert}")
ziel = (start + self.zufallswert, len(self.pfad) - 1)
print(self.pfad)
# print(f"{self.pfad[start + self.zufallswert][0]}")
# print(f"math: {math.floor(start + self.zufallswert / 7)}")
# print(f"ziel_y: {self.pfad[start + self.zufallswert][1]}")
start_x, start_y = self.pfad[start]
self.spielfiguren[start_x][start_y].remove(figur)
ziel_x, ziel_y = self.pfad[ziel]
print(f"self.positionen[figur]: {self.positionen[figur]}, {figur}")
print(f"Hier: {start_x} {start_y}")
try:
ziel_x = self.pfad[start + self.zufallswert][0]
ziel_y = self.pfad[start + self.zufallswert][1]
except IndexError:
ziel_x = self.pfad[len(self.pfad) - 1][0]
ziel_y = self.pfad[len(self.pfad) - 1][1]
print(f"Ziel-Koordinaten: {ziel_x} {ziel_y}")
self.spielfiguren[ziel_x][ziel_y].append(figur)
self.positionen[figur] = ziel
self.positionen[figur] = ziel[0]
print(f"Figur {figur}: von {start} nach {ziel} (Gewürfelt: {self.zufallswert})")
self.am_zug = (self.am_zug + 1) % 4 # mit Modulo-Operator ist (3 + 1) % wieder 0
self.am_zug = (self.am_zug + 1) % 4 # mit Modulo-Operator ist (3 + 1) % wieder 0
def mouseButtonClick(self, x, y):
if x >= 270 and y >= 770 and x <= 490 and y <= 830: