Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 1.1

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):

Download Icon 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.