|
|
@ -1,9 +1,10 @@ |
|
|
|
#!/usr/bin/env python3 |
|
|
|
#-.-coding=UTF8 -.- |
|
|
|
|
|
|
|
# Mal ein kompletter Rewrite |
|
|
|
# A more or less rewrite of the original pygame version |
|
|
|
# by james Turk in 2007 |
|
|
|
# |
|
|
|
# Alle Fehler gehen auf mich |
|
|
|
# Greetings |
|
|
|
# |
|
|
|
# kresse 2020 |
|
|
|
|
|
|
@ -27,7 +28,11 @@ BLUE = (0,0,200) |
|
|
|
# Dimension of the display Window |
|
|
|
x_dim =1200 |
|
|
|
y_dim =768 |
|
|
|
# |
|
|
|
|
|
|
|
# Dimension of the display Window |
|
|
|
x_dim =1920 |
|
|
|
y_dim =1080 |
|
|
|
|
|
|
|
# Folder for sound effects |
|
|
|
sfx="sfx//" |
|
|
@ -109,18 +114,15 @@ class Spieler(): |
|
|
|
self.punkte=0 |
|
|
|
self.nr =nummer %spieler_anzahl |
|
|
|
self.color=Farbliste[self.nr] |
|
|
|
#print ("Spieler_Name = ",self.name) |
|
|
|
#print ("spieler_Nr = ",self.nr) |
|
|
|
#print ("Spielerfarbe = ",self.color) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def buzz(): |
|
|
|
pygame.mixer.Sound(sfx+'game-fx-1.wav').play() |
|
|
|
|
|
|
|
|
|
|
|
def percent_tile(x1,y1,x2,y2): |
|
|
|
return pygame.Rect(int(x_dim*x1/100),int(y_dim*y1/100),int(x_dim*x2/100),int(y_dim*y2/100)) |
|
|
|
|
|
|
|
|
|
|
|
def main(): |
|
|
|
# ich bin echt genervt, das das hier so definiert werden muss, |
|
|
@ -176,6 +178,12 @@ def main(): |
|
|
|
def wandAnzeigen(screen): |
|
|
|
global fragen |
|
|
|
|
|
|
|
BG_COLOR = BLUE |
|
|
|
FG_COLOR = WHITE |
|
|
|
wall_font_name="None" |
|
|
|
big_font_size=90 |
|
|
|
small_font_size=48 |
|
|
|
|
|
|
|
screen.blit(background, (0, 0)) |
|
|
|
|
|
|
|
if modus =="aussuchen": |
|
|
@ -185,32 +193,33 @@ def main(): |
|
|
|
xStep = int(xEnd/6) |
|
|
|
yStep = int(yEnd/6) |
|
|
|
|
|
|
|
# Gitter zeichnen |
|
|
|
for x in range(xStart, xEnd+1, xStep): |
|
|
|
pygame.draw.line(screen, BLACK, (x,yStart), (x,yEnd), 5) |
|
|
|
for y in range(yStart, yEnd+1, yStep): |
|
|
|
pygame.draw.line(screen, BLACK, (xStart,y), (xEnd,y), 5) |
|
|
|
|
|
|
|
|
|
|
|
# Beschriftung |
|
|
|
for x in range(0, 6): |
|
|
|
ausgabe=(fragen.fragenfeld[x*5].kategorie) |
|
|
|
ausgabe=" "+(fragen.fragenfeld[x*5].kategorie) |
|
|
|
ausgabe=ausgabe.replace('\\n' , '\n ') |
|
|
|
# print (ausgabe) |
|
|
|
# |
|
|
|
# textCentered(ausgabe) |
|
|
|
text = smallFont.render(ausgabe, 1, WHITE) |
|
|
|
screen.blit(text, (x*xStep+10,25)) |
|
|
|
#text = smallFont.render(ausgabe, 1, WHITE) |
|
|
|
#screen.blit(text, (x*xStep+10,25)) |
|
|
|
pgi.text_output (screen,percent_tile(x*16.6,0,18,20),ausgabe,BG_COLOR,FG_COLOR,wall_font_name,small_font_size) |
|
|
|
|
|
|
|
|
|
|
|
for y in range(0, 5): |
|
|
|
jetztfrage=fragen.fragenfeld[x*5+y] |
|
|
|
if jetztfrage.farbe== BLUE: |
|
|
|
text = bigFont.render(str(fragen.fragenfeld[x*5+y].punkte), 1, WHITE) |
|
|
|
screen.blit(text, (x*xStep+7,(y+1)*yStep+10)) |
|
|
|
pgi.text_output (screen,percent_tile(x*16.7,(y+1)*90*(yStep/yEnd),18,20)," "+ str(fragen.fragenfeld[x*5+y].punkte),BG_COLOR,FG_COLOR,wall_font_name,big_font_size) |
|
|
|
else: |
|
|
|
hoehe=yStep-9 |
|
|
|
pygame.draw.line(screen, jetztfrage.farbe, (x*xStep+5,(y+1)*yStep+int(hoehe/2)+5), ((x+1)*xStep-4,(y+1)*yStep+int(hoehe/2)+5), int(hoehe)) |
|
|
|
text = bigFont.render(str(fragen.fragenfeld[x*5+y].punkte), 1, BLACK) |
|
|
|
screen.blit(text, (x*xStep+7,(y+1)*yStep+10)) |
|
|
|
|
|
|
|
pgi.text_output (screen,percent_tile(x*16.7,(y+1)*90*(yStep/yEnd),18,20),"",jetztfrage.farbe,BLACK,wall_font_name,big_font_size) |
|
|
|
|
|
|
|
|
|
|
|
# Gitter zeichnen |
|
|
|
for x in range(xStart, xEnd+1, xStep): |
|
|
|
pygame.draw.line(screen, FG_COLOR, (x,yStart), (x,yEnd), 5) |
|
|
|
for y in range(yStart, yEnd+1, yStep): |
|
|
|
pygame.draw.line(screen, FG_COLOR, (xStart,y), (xEnd,y), 5) |
|
|
|
|
|
|
|
# Spieler |
|
|
|
for _ in spieler: |
|
|
|
linie_beginn= int(xEnd/(len(spieler)))*_.nr |
|
|
@ -252,12 +261,15 @@ def main(): |
|
|
|
# |
|
|
|
if druecker == -99: |
|
|
|
drueckertext="WIR WARTEN...." |
|
|
|
pgi.text_output (screen,percent_tile(40,85,24,15),drueckertext,BLUE,BLACK,font_name="arial",font_size=40) |
|
|
|
else: |
|
|
|
zeichneFarbe(druecker.color) |
|
|
|
drueckertext=druecker.name |
|
|
|
#zeichneFarbe(druecker.color) |
|
|
|
#drueckertext=druecker.name |
|
|
|
pgi.text_output (screen,percent_tile(40,85,24,15)," "+druecker.name,(druecker.color),BLACK,font_name="arial",font_size=40) |
|
|
|
# |
|
|
|
# |
|
|
|
textunten(drueckertext) |
|
|
|
#textunten(drueckertext) |
|
|
|
|
|
|
|
else: |
|
|
|
Anzeigetext=" Die FRAGE HATTEN WIR SCHON !!!" |
|
|
|
textCentered(Anzeigetext) |
|
|
@ -320,16 +332,12 @@ def main(): |
|
|
|
pygame.mixer.music.play(0) |
|
|
|
|
|
|
|
#Fragenpaket auswählen |
|
|
|
#fragenpaket= input('Welches Fragenpaket') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Use Surface at Rect to print Text, with BGColor, TextColor in Font With Size |
|
|
|
field_question= pygame.Rect(int(x_dim*0.05),int(y_dim*0.85),int(x_dim*0.4),int(y_dim*0.15)) |
|
|
|
pgi.text_output (screen,field_question,"Welches Fragenpaket?",BLACK,GREEN,font_name="ocra",font_size=40) |
|
|
|
pgi.text_output (screen,percent_tile(5,85,40,15),"Welches Fragenpaket?",BLACK,GREEN,font_name="ocra",font_size=40) |
|
|
|
|
|
|
|
# Use Surface at Rect to input Text, with BGColor, TextColor in Font With Size |
|
|
|
field_answer= pygame.Rect(int(x_dim*0.45),int(y_dim*0.85),int(x_dim*0.4),int(y_dim*0.15)) |
|
|
|
fragenpaket= pgi.text_input (screen,field_answer,BLACK,GREEN,font_name="ocra",font_size=40) |
|
|
|
fragenpaket= pgi.text_input (screen,percent_tile(45,85,40,15),BLACK,GREEN,font_name="ocra",font_size=40) |
|
|
|
|
|
|
|
if fragenpaket =="": |
|
|
|
fragenpaket="1" |
|
|
@ -355,18 +363,14 @@ def main(): |
|
|
|
|
|
|
|
# initialize Spieler |
|
|
|
for spieler_nr in range(spieler_anzahl): |
|
|
|
#spieler.append (Spieler((input("Name des "+ str(spieler_nr+1) +". Spielers > ")+" ")[0:11],spieler_nr)) |
|
|
|
|
|
|
|
|
|
|
|
# Use Surface at Rect to print Text, with BGColor, TextColor in Font With Size |
|
|
|
question="Name des "+ str(spieler_nr+1) +". Spielers? " |
|
|
|
field_question= pygame.Rect(int(x_dim*0.05),int(y_dim*0.85),int(x_dim*0.4),int(y_dim*0.15)) |
|
|
|
pgi.text_output (screen,field_question,question,BLACK,GREEN,font_name="ocra",font_size=35) |
|
|
|
|
|
|
|
pgi.text_output (screen,percent_tile(5,85,40,15),question,BLACK,GREEN,font_name="ocra",font_size=40) |
|
|
|
|
|
|
|
# Use Surface at Rect to input Text, with BGColor, TextColor in Font With Size |
|
|
|
field_answer= pygame.Rect(int(x_dim*0.45),int(y_dim*0.85),int(x_dim*0.4),int(y_dim*0.15)) |
|
|
|
player_name= pgi.text_input (screen,field_answer,BLACK,GREEN,font_name="ocra",font_size=35) |
|
|
|
|
|
|
|
player_name=pgi.text_input (screen,percent_tile(45,85,40,15),BLACK,GREEN,font_name="ocra",font_size=40) |
|
|
|
|
|
|
|
spieler.append(Spieler(player_name[0:11],spieler_nr)) |
|
|
|
|
|
|
|
|
|
|
@ -381,7 +385,7 @@ def main(): |
|
|
|
|
|
|
|
# Hauptschleife |
|
|
|
while not quit: |
|
|
|
clock.tick(60) |
|
|
|
clock.tick(30) |
|
|
|
for event in pygame.event.get(): |
|
|
|
if event.type == QUIT: |
|
|
|
quit = True |
|
|
|