Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Design Operation And Evaluation Of Mobile Communications

Authors: Gavriel Salvendy ,June Wei

1st Edition

3030770249, 978-3030770242

More Books

Students also viewed these Programming questions

Question

What are the three kinds of research types? Explain each type.

Answered: 1 week ago