Background animation tutorial Flash

Animation for Flash Games (part 2): Sprite Manipulation for the Scripter

By Patrick Fram

This article-the second in the series-shows Adobe Flash* game scripters how to manipulate animated sprites for use in Flash* games. The Flash* player was recently updated to make it more efficient, and therefore more assessable to mobile devices and smaller computers like netbooks. Given the growing popularity of these devices, Flash* game development has become an increasingly valuable skill.

The previous article discussed how artists could create a game sprite in a way that would make the scripter's job easier. This article uses that same game sprite to create a simple platform game engine.

Getting Started

Figure 1. The robot sprite movie clip created in part 1

To recap a bit, you created a game sprite of a robot character in the last article (see Figure 1). It was a single movie clip, with all of its animations existing in one timeline (see Figure 2). Each animation section was labeled in the timeline, so not only was it easy to visually tell what you were looking at, but the script would be able to use these labels to control the animation.

Figure 2. The labeled timeline inside the game sprite movie clip

To get started on your next task, create a new Adobe ActionScript* 3.0 file and add the robot movie clip from part 1 to the stage. Give it an instance name so that your code can refer to it; to do so, open the Properties panel, and name the instance robot.

Scripting the Sprite's MovieClip for Animation Control

Now, the artist built this sprite in an organized way, but it is not quite ready yet. You have to add a bit of ActionScript* code to it to get it to work properly. The simplest thing you need to do is add code to control how animations play. Although you haven't written it yet, the system that will control which animation is playing will look something like this:


Now, if that line were used right now, the sprite would start playing at the still label, and then keep going right through and into the run animation. So, add a single line of code to the still frame:


Now, when that frame is played, the sprite will freeze on it until told otherwise.

Next, think about the run animation. Unlike the static still animation, this one is a loop that's expected to cycle through until told otherwise. So, add a single line of code at the end of the animation:


Now, when this animation gets to the end, it will reset itself to the first run frame and keep looping until you tell it to do something else (see Figure 3).

More about Background animation tutorial Flash

NeriumAD will reduce and fade stretch marks : )

by creativspirit

See the amazing Real Results in Before/After stretch mark photos and Others on my fBook bizpage: Nerium Me Beautiful
(I can't post images here yet, am a new forum member)
NeriumAD is made from a patented extract of the Nerium Oleander plant which was discovered in Biochemical research for treating skin cancer. It is a non~toxic, non~comedogenic (won't clog pores), Paraben~free, Gluten~free, Cruelty~free night treatment Anti~aging skin cream ideal for all skin types. Consistently 20~65%+ effective on Fine lines and Wrinkles, Hyper~pigmentation, Skin texture, Aging and Sun~damaged skin, Stretch marks and Acne

CorelDRAW X7 review: Customizable features make this robust design program ..  — PCWorld
.. purchase, as well as a $25 monthly subscription. People miffed by Adobe's wholesale move to subscriptions will find a great alternative here. ..

Galaxy 61 Delivers Show Open for VH1's 'The Fabulous Life  — Animation World Network
VHI recently called upon Galaxy 61 to create a show intro for the new 2014 season of The Fabulous Life, the hit series that reveals the extravagant places, possessions and pastimes of pop-culture's most famous celebrities. The Brooklyn-based ..

Hunterdon County Polytech students bridge the gap thanks to local Rotary Clubs  — Hunterdon County Democrat
This year's Job Fair, on March 25, attracted the Dave Gansfuss Allstate Agent for an agency logo; G&H Publishing and author Katherine Kurz for children's book illustrations; Artiste Salon for a new logo, brochure and social media materials; St.

Related Posts