Hi!I'm new to programming and I'm trying to make a small game using pygame. The game is quite simple. There are 4 squares. A frog appears in one of these squares at random. The player must click on the frog before it goes away to another square. If the player successfully clicks on the frog, 1 point is added.The code is very, very incomplete right now. The problem I'm having right now is this - the points are added just BEFORE the frog appears in the square. For example: I click on an empty square and I get a point, even though the frog appears directly after that. And when there IS a frog in the square and I click on it, I get no points.I sincerely hope you understand what I'm saying since English is not my native language.

Notice these three phases in the main loop.You should also stop what you are doing, and take the time now to learn about functions.Game programming requires the use of classes and OO.You will definitely need to learn classes pretty quickly; but you need to learn functions immediately.