Question
Have the popped bubbles shrink A general principle in designing games is that things shouldn't happen abruptly. When an object is destroyed it shouldn't instantly
Have the popped bubbles shrink
A general principle in designing games is that things shouldn't happen abruptly. When an object is destroyed it shouldn't instantly disappear; instead it should show itself dying. Change Pop so that when you pop a bubble, it puts on a 'dying act.' You might do this by overriding the die methods by turning on a BOOL _dying flag instead of calling delete_me right away. And now override the animate(dt) method to shrink the bubbles. We might think of the bubbles as losing volume at some constant negative rate dV/dt called LEAKRATE. Since radius is proportional to the cube root of the volume, a little calculus reveals that dr/dt should be proportional to LEAKRATE/(r*r). So we do something like setRadius(radius() dt*LEAKRATE/(radius()*radius())) inside animate(dt). And when a bubble's radius gets below 0.0, then you actually call its delete_me method, so do a check something like if (radius()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started