1

I am currently working on a game for a school project. Basically: The Character gets hunted by a rect that is constantly moving towards him. Now whenever it Collides I want a big red box to show up with the Text "Gameover" in the middle of the screen. However Rects can only be colored on the border and in the Pygame Documentation I don't understand what I first need to do to make a Surface work the way I want.

Now my question: How can I implement a red Surface to pop up once the character collides with the enemy to signal a "Gameover".

What I thought about was setting an "if" statement into the draw function that gets set true once a collision occurs to only draw the surface when the players goes Gameover.

Something like: (Incase anyone is wondering: "Tesbold" is the players character and "Follower" the object hunting the Player)

def draw():
    screen.clear()
    screen.fill((200,200,200))
    Tesbold.draw()
    Follower.draw()
    screen.surface = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
    if Gameover = True:
        (Draw Red Box with Text "Gameover" in the middle of the screen)
Rabbid76
  • 202,892
  • 27
  • 131
  • 174
Ignitris
  • 55
  • 5

0 Answers0