0

How do you get a rectangle (rect) to appear on the output screen for a set amount of time, for example 2 seconds, before disappearing? I am making a version of wormy a nibbles clone. I would also like to know how to make an apple disappear when the worm "eats" it.

PtotheK
  • 13
  • 4
user2309523049
  • 7
  • 1
  • 1
  • 4
  • 2
    It looks like you want us to write some code for you. While many users are willing to produce code for a coder in distress, they usually only help when the poster has already tried to solve the problem on their own. A good way to demonstrate this effort is to include the code you've written so far, example input (if there is any), the expected output, and the output you actually get (console output, tracebacks, etc.). The more detail you provide, the more answers you are likely to receive. Check the [FAQ] and [ask]. – Sudheesh Singanamalla Nov 06 '17 at 04:19
  • Ok! It's just that I have never coded before, so I don't know at all what to do or what to try. I have looked at the pygame.time functions, but none of them make any sense to me. – user2309523049 Nov 06 '17 at 04:33
  • Take a look at [these answers](https://stackoverflow.com/questions/30720665/countdown-timer-in-pygame) (`pygame.time.get_ticks`, `pygame.time.set_timer` or the delta time solution) to learn how to implement a timer in pygame. Then only draw the rect until the time is up. – skrx Nov 07 '17 at 00:10

1 Answers1

0

You don't delete objects, you draw over them in Pygame. Concerning your disappearing rectangles, a simple Timer will suffice. Now, we can't write code for you here without you providing any info so I've just stated some basic information, so the next time you post a question, provide some info and read the How to ask page, and welcome to SO.

Milan Velebit
  • 1,933
  • 2
  • 15
  • 32