I am making a game, and when the player runs into a certain block it changes the size of a circle on the top. The problem is, whenever the player runs into the block it disappears. How can I fix this?
What most likely happens from the (very basic and incomplete) description of your issue is that each frame you detect a collision, you reduce the size of the shape. Thus, frame after frame the shape gets smaller and smaller, so much that it's no longer visible.
When you get the collision and you change the size of the shape, you also have to set a flag to tell it to not do it again the following frames. You reset the flag once there is no longer any collision detected.
It's hard to know what's happening without seeing example code but it could be the order with which you erase and draw the sprites. For example, if you had the following steps:
- Erase circle
- Draw smaller circle
- Erase player <-- this is where you might be erasing the smaller circle
- Draw player
If the above is your problem, the fix would be to erase everything, then draw everything in the order you want (e.g. correct layering).