I'm trying to change my Game screen into the Game Over Screen once one player hits a score of 3. In my pong file, I have the following. Gameover_state is a global variable.
def main():
while running:
#Code and event based things
#if the score reaches 3, then the game is over
if player_paddle.score == 3 or ai_paddle.score == 3:
gameover_state = True
In my screens file which controls how screens change to another, I have this in my Gamestate screen:
class GameScene(SceneBase):
def __init__(self):
SceneBase.__init__(self)
def ProcessInput(self, events, pressed_keys):
for event in events:
if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
# Move to the next scene when the user pressed Enter
self.SwitchToScene(GameOverScene())
if event.type == pygame.KEYUP:
print("You are hitting up!")
print(self.next)
def Update(self):
#pongtry4.main()
if pongtry4.gameover_state == True:
self.SwitchToScene(GameOverScene())
pongtry4.main()
def Render(self, screen):
# The game scene is just a blank blue screen
#screen.fill((0, 0, 255))
pass
I've tried debugging and my gameover_state eventually returns true after either ai or player gets 3. However, the gamestate doesn't change properly to the game over screen. Is the problem the order of how I call pongtry4.main() or something else? Thanks.
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
This question already has an answer here:
i have a problem with create a sql queryi have this situation
I'm trying to setup a galera MariaDB 101 cluster on Centos 7
Question: identify all clients who have viewed all properties with three rooms