Article Preview
Buy Now
FEATURE
Three Ways to Animate in REALbasic
Issue: 1.1 (August/September 2002)
Author: Joe Strout
Author Bio: Joe Strout is a senior software engineer at REAL Software, and likes to dabble in making games with REALbasic.
Article Description: Three different animation techniques
Article Length (in bytes): 34,499
Starting Page Number: 18
Article Number: 1004
Resource File(s):
1004.zip Updated: 2013-03-11 19:07:55
Related Web Link(s):
http://www.quesa.org/
Excerpt of article text...
Nearly every software developer has a need to generate some animated graphics sooner or later. Animation is the bread and butter of game developers, but it can be used effectively in many other places as well, from an eye-catching About Box to a custom progress indicator. REALbasic provides several different ways to produce animation, each with pros and cons.
In this article, we'll pose a moderately simple animation problem: an image of a rocket flying over a starry background, trailing little puffs of smoke. Then we'll solve this in three different ways: using a simple Canvas, using a SpriteSurface, and using an Rb3DSpace. By the end, you should be well-equipped to use the right tool for any animation job.
The Problem
For the sake of this article, assume you need to make a rocket fly over a background of stars. Every now and then the rocket emits a little puff of smoke which should move in the direction opposite that of the rocket, expand a bit, and then disappear. If possible, the smoke puffs should be translucent (because translucency is cool).
So we'll be working with basically three images: the rocket itself, the background, and the smoke puff. The smoke puff actually requires a series of images, so we can make it expand and grow more diffuse. To reduce the number of files we have to work with, we'll combine all the smoke puff images into one picture. Since we want the smoke puffs to be translucent they also need a mask; we'll put that into the same source picture too.
The three source pictures are shown in Figure 1. If you're creating your own images in order to follow along at home, be sure to use the same names and sizes or else you'll have to make some adjustments to the code.
...End of Excerpt. Please purchase the magazine to read the full article.