Skip to content

Commit

Permalink
fixed checking wrong pausescreen button
Browse files Browse the repository at this point in the history
  • Loading branch information
nxdens committed Jun 30, 2022
1 parent 593b2dc commit 3c2c576
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
42 changes: 24 additions & 18 deletions background.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,10 @@ def __init__(self,level,levels,round,rounds,background,config,agents = [],levelS
#a list of tuples: (font render, rect)
self.aTextList = []

if "questions" in self.config:
self.inQuestions = False

if "questions" in self.config:
self.inQuestions = True
self.renderQuestions()


Expand Down Expand Up @@ -719,25 +722,28 @@ def menuInteraction(self,mousePos):
x,y = mousePos

#starting game
inX = x in range(self.startRect[0], self.startRect[0] + self.startRect[2])
inY = y in range(self.startRect[1], self.startRect[1] + self.startRect[3])
if (inX and inY):
#check if all answered
self.paused = False
self.startText = self.font.render('Start',True,(0,255,0))
self.endLevelText = self.font.render('End Level',True,(0,255,0))
else:
self.startText = self.font.render('Start',True,(0,0,0))
self.endLevelText = self.font.render('End Level',True,(0,0,0))
if self.inQuestions:
inX = x in range(self.startRect[0], self.startRect[0] + self.startRect[2])
inY = y in range(self.startRect[1], self.startRect[1] + self.startRect[3])

#next round
inX = x in range(self.nextRoundRect[0], self.nextRoundRect[0] + self.nextRoundRect[2])
inY = y in range(self.nextRoundRect[1], self.nextRoundRect[1] + self.nextRoundRect[3])
if (inX and inY):
self.paused = False
self.nextText = self.font.render('Next Round',True,(0,255,0))
if (inX and inY):
#check if all answered
self.paused = False
self.startText = self.font.render('Start',True,(0,255,0))
self.endLevelText = self.font.render('End Level',True,(0,255,0))
else:
self.startText = self.font.render('Start',True,(0,0,0))
self.endLevelText = self.font.render('End Level',True,(0,0,0))
else:
self.nextText = self.font.render('Next Round',True,(0,0,0))
#next round
inX = x in range(self.nextRoundRect[0], self.nextRoundRect[0] + self.nextRoundRect[2])
inY = y in range(self.nextRoundRect[1], self.nextRoundRect[1] + self.nextRoundRect[3])

if (inX and inY):
self.paused = False
self.nextText = self.font.render('Next Round',True,(0,255,0))
else:
self.nextText = self.font.render('Next Round',True,(0,0,0))

#answering questions - aTextList is indexed by the question number, list list of answers
currInd1 = 0
Expand Down
2 changes: 1 addition & 1 deletion configs/structure.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"test" :
{
"description" : "test",
"layout" : [["after_block_questions",1]]
"layout" : [["goodSpeed",1],["questions",1],["after_block_questions",1]]
}
},

Expand Down

0 comments on commit 3c2c576

Please sign in to comment.