Answered step by step
Verified Expert Solution
Link Copied!

Question

00
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 with AI-Powered 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

Management Accounting Information for Decision-Making and Strategy Execution

Authors: Anthony A. Atkinson, Robert S. Kaplan, Ella Mae Matsumura, S. Mark Young

6th Edition

978-0137024971

Students also viewed these Programming questions