02.02.2013 Views

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 3: Simple cut-out animation<br />

Most of the script simply tells the playback head <strong>to</strong> move <strong>to</strong> another label. The only code that is<br />

a little more complicated is for the loop back for the walks; in this code the keyboard is tested and if<br />

the arrow keys are not down then the playback jumps <strong>to</strong> the ‘S<strong>to</strong>pLeft’ or ‘S<strong>to</strong>pRight’ dependent<br />

on the current direction. Now that the animation is all prepared we need <strong>to</strong> place this inside a<br />

symbol. Open the project ‘Examples/Chapter03.FatCatSprite.fla’. In this project the animations<br />

from the earlier project have all been pasted in<strong>to</strong> a symbol called ‘Cat’. To paste the frames, simply<br />

select them all in the timeline and choose ‘Copy Frames’ from the context menu. Then move <strong>to</strong><br />

the new location and choose ‘Paste Frames’ from the context menu.<br />

By pressing the left or right arrow keys the cat will now walk either left or right, turning at the<br />

edges of the screen. See if you can work out how the code works; it is very simple and after you<br />

have completed Section 3 of this book you will definitely understand exactly how it is done. But<br />

that is for a later chapter.<br />

Summary<br />

In this chapter we looked at how <strong>to</strong> create interesting and dynamic animation that is both quick<br />

<strong>to</strong> produce and small in file size. We looked at creating this using motion tweening and using<br />

keyframes. We looked at how <strong>to</strong> enhance a cut-out animation using additional drawn frames and<br />

how setting the properties for a ‘graphic’ can control the playback of these. Finally we looked at<br />

connecting several animation loops <strong>to</strong>gether so we can put a character under user control. In the<br />

next chapter we will look in<strong>to</strong> how we can create animations using computer animation packages<br />

and import these in<strong>to</strong> <strong>Flash</strong>.<br />

45

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!