30.04.2013 Views

Ahoy!- Hosted by www.commodore.ca

Ahoy!- Hosted by www.commodore.ca

Ahoy!- Hosted by www.commodore.ca

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

standing standing still, still , then then draw draw his position position a moment moment later,<br />

one one leg leg slightly moved, and and then then again, with with the the leg leg<br />

moved moved more, and and so so on, until until the the whole sequence sequence is is<br />

complete. complete.<br />

You You have have the the same same limitation limitation that that animated animated filmfilmmakersmakers have-every have-every detail detail has has aa price. Instead Instead of of<br />

money, though, you pay in memory and speed. Still,<br />

we we <strong>ca</strong>n <strong>ca</strong>n use some some of of the the same same compromises compromises that that<br />

Hanna Hanna Barbera, Barbera, Warner Brothers, Brothers, and and Disney have have<br />

used:<br />

I) I) If an an action action is is repeated repeated over over and and over, use use the<br />

same same pictures pictures over over and and over. over. That That is, is, once once you you have have<br />

aa sequence equence of of aa figure figure walldng, walking, you you <strong>ca</strong>n <strong>ca</strong>n use use the the<br />

same same sequence sequence twenty twenty times times to to make make him him walk walk<br />

twenty steps.<br />

2) 2) If If most most of of the the picture picture doesn't doesn't change, change, you only only<br />

have have to to redraw redraw the the parts parts of of it that that do change. change. AniAnimatorsmators use use cels cels on on aa background; background; the the eel cels <strong>ca</strong>n <strong>ca</strong>n be be<br />

moved moved around around and and interchanged interchanged to create create each each new new<br />

image image without having having to to draw draw more more than than a a few few parts parts<br />

of of the the picture picture each each time.<br />

Redrawing Redrawing the the picture picture every every time time would would make make ananimationimation far far too too expensive expensive ever ever to do. The The same same<br />

thing thing with with computer computer animation: animation: you <strong>ca</strong>nnot <strong>ca</strong>nnot animate animate<br />

the the full full screen screen <strong>by</strong> <strong>by</strong> redrawing redrawing it it frame <strong>by</strong> <strong>by</strong> frame. frame.<br />

There There isn't enough enough memory memory in in your your computer computer or or on on<br />

your your disk disk to to animate animate more more than a a few few seconds' seconds'<br />

worth worth of of action action if if you have have to to redraw the whole whole<br />

screen. screen.<br />

So So instead, instead, we we change change only only pans pans of of the the screen.<br />

We've We've already already worked worked with with custom custom characters, characters,<br />

which which let us create a a few few "building "building blocks" blocks" that that we<br />

<strong>ca</strong>n <strong>ca</strong>n use use over over and and over over again again <strong>by</strong> <strong>by</strong> PRINTing PRINTing our our new<br />

characters characters to to the the screen screen many many times. times. We've We've already<br />

moved the the custom custom characters characters around around on on the the screen. screen.<br />

Now Now comes comes aa programming programming technique technique that with with aa<br />

single single POKE POKE lets lets you change change every every single single character character<br />

in in the the character character set at at once. By By doing doing it it several seyeral<br />

times in a row, row , you <strong>ca</strong>n animate an entire screen at<br />

once, once, bringing bringing it it to to life without without noticeably noticeably slowing slowing<br />

down down your your program. program.<br />

It does does eat eat up up memory, and and you you <strong>ca</strong>n't <strong>ca</strong>n't have have more more<br />

than than seven seven stages stages in the the complete complete animated animated cycle. cycle.<br />

But as you'll see with the two rwo demonstration programsgrams<br />

on on page page 72. 72, irs it's enough enough to to make make some some really really<br />

dazzling effects without elaborate progranlming.<br />

programming.<br />

CHARACTER SET FLIPPING<br />

Last month month we we created created custom custom character character sets, sets, and and<br />

told told the the computer computer where where to to find find the the new new character character<br />

set set <strong>by</strong> <strong>by</strong> POKEing POKEing its lo<strong>ca</strong>tion code code into into lo<strong>ca</strong>tion lo<strong>ca</strong>tion<br />

53272. Now Now we'll we'll create create several several character character sets, sets, and and<br />

put put them them in in order in memory. memory. If If we we had had three three charcharacteracter sets sets in in our our sequence, sequence, we we would would put put one one at at 10-<br />

<strong>ca</strong>tion<strong>ca</strong>tion code code 10, one one at at 12, 12, and and one one at at 14. 14.<br />

Then, Then, within within each each set, set , the the same character character would would<br />

stand stand for for a a different different stage stage in in the the animated animated sequence. sequence.<br />

For For instance, instance, lers let's say say we we are creating creating aa four-stage four-stage<br />

bouncing bouncing ball. ball. Stage Stage II has has the the ball ball high high in in the air. air.<br />

Stage Stage 22 has has it it halfway halfway to to the the floor. floor. Stage Stage 3 has has it it<br />

on on the the floor, partly partly flattened. flattened . Stage Stage 44 has it it back back up up<br />

again, again, halfway halfway to to the the top. top.<br />

So So in in the the first first character character set, the letter letter A A would be be<br />

replaced replaced <strong>by</strong> <strong>by</strong> the the pattern pattern for for stage stage I. In In the the second second<br />

character character set, set, the the letter letter A A would would have have the the pattern pattern for for<br />

stage stage 2, and and so so on, through through the the four four character character sets.<br />

Your Your program program PRINT PRINTs the the letter AA on on the the screen screen<br />

wherever wherever you want want the the bouncing bouncing ball. ball. You <strong>ca</strong>n <strong>ca</strong>n have have<br />

one one bouncing bouncing ball, ball , or or dozens. dozens. They They will wiJi all bounce bounce<br />

at once when you cycle through the character sets.<br />

You You just POKE each character character set's set's lo<strong>ca</strong>tion lo<strong>ca</strong>tion code code<br />

into into 53272 in in tum, and the the entire screen screen changes changes at<br />

once-without once-without your your having having to to PRINT PRINT anything anything difdifferentferent on on the the screen. screen. One POKE POKE animates animates the the entire entire<br />

screen! screen!<br />

The The first first demonstration demonstration program, program, <strong>ca</strong>lled <strong>ca</strong>lled RUIlller, Runner,<br />

is a three-stage animation of a figure running. The<br />

left-facing left-facing version version of of the runner is is shown shown in in the the figfigure.ure. Notice that that the figure figure consists consists of of two rwo characters,<br />

one atop the other. The only motion is in the<br />

legs legs and and arms-the arms-the body body stays in in the same same place.<br />

The The right-facing right-facing characters characters are are identi<strong>ca</strong>l, identi<strong>ca</strong>l, exeept except they they<br />

are the mirror image.<br />

The second demonstration program, <strong>ca</strong>lled Movers. Movers ,<br />

shows shows aa four-stage four-stage animation animation of of seven seven different different figfigures.ures. There There are: are:<br />

AA bouncing bouncing ball ball<br />

AA spinning spinning bar<br />

AA spider spider moving moving up up and and down down<br />

AA cone cone that that rises rises and and falls falls<br />

AA circle circle that that pulsates pulsates<br />

AA skull skull that that opens opens and and closes closes its its mouth<br />

A snake that that goes goes around around in in circles circles<br />

All All of of these these are are animated with aa single single POKE POKE<br />

AHOY! 19

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

Saved successfully!

Ooh no, something went wrong!