I have a student that has been working on this interactive card project and went beyond the scope of the project but is trying to make it work. He wants the “boom” to appear randomly, grow, and then disappear. He has it appear randomly and grow with no problems.
We have both tried many different things (moving background in to and out of draw loop)and they either don’t appear (background in front) or they appear, grow, but never disappear.
I know that this has to be an easy fix but I just cannot figure it out right now.
Thank you!
The link you shared with us is the link to the lesson in the curriculum itself, but not the link to your student’s specific project. Can you get them to share it with the “share” button and send us that link so we can help you debug it?
In line 28, the student has boom.scale = boom.scale + 1 every time the draw loop runs, which is 30 times per second. In lines 37 & 38, they hide boom if its scale grows over 2. This occurs very quickly as the loop increments.
I changed this in my version of the code to something like boom.scale = boom.scale times a factor very slightly larger than 1 (like 1.005 or 1.01) and the boom grew much more slowly.
I’d encourage asking your student to think about how quickly they want the boom to grow and then choose a multiplication factor accordingly.
I don’t see any booms coming back after the first one – is this something the student will work on? How will they reset the scale & trigger it to appear again?