0

For a game I'm making, I need to display the lives to the user. They are represented by 3 heart images I got from google. Each heart is an individual image.

When the user makes a mistake, I want one of the heart images to disappear on the screen. How can I do this?

I'm only a beginner and am making this on pygame.

Thank you.

Davina
  • 63
  • 8
  • Ho have to show use your code. In general, you cannot remove something that was drawn on the screen. You have to redraw the scene in every frame. If the player loses a heart, simply draw 1 heart less. – Rabbid76 Jan 09 '21 at 14:54
  • How do i draw on the screen if the image I have is from google? – Davina Jan 09 '21 at 14:56
  • See [What is a good way to draw images using pygame?](https://stackoverflow.com/questions/8873219/what-is-a-good-way-to-draw-images-using-pygame/64630591#64630591) – Rabbid76 Jan 09 '21 at 14:58
  • So when I can draw my image on the screen by converting it, there's no way of making it disappear? – Davina Jan 09 '21 at 15:01
  • 1
    The screen is just a bunch of pixels. A color of a pixel can only be changed, but changing a color cannot be undone. When you "draw" an image on the screen, only the color of the pixels is copied from the image to the screen. – Rabbid76 Jan 09 '21 at 15:05
  • Thank you @Rabbid76 I shall try changing it – Davina Jan 09 '21 at 15:06

0 Answers0