I have a student who created this program. I have checked it and put in debug code to figure out what is happening, but cannot. In the IF statement on line 43 he wants to make a trashcan appear and the background and the person to disappear. The code visible = false isn’t working for the background and the person, but the visibility for the trashcan is working. I put in code to use sprite.rotation to see what was happening and you will see that it then draws the sprite on top of itself. Can you see any errors in this code?
I just took a look at your code and have a little feedback. If he wants to make something disappear that is already on the screen, a new background needs to be drawn over the existing object, because using the object.visible=false command will make it so the next time the drawsprites function runs, the object will not be drawn, however, it doesn’t erase what is already on the screen.
By making your background sprite no longer drawn, it won’t cover up the person or anything else anymore, so he may need to look at adding a solid colored background and/or a different sprite background that will be drawn instead of the house background he is using now.
I hope this makes sense, but if not, please let me know and I’m happy to try and simplify my explanation.
Mike
I have learned something new. And, it makes perfect sense. Thank you!