CODINGLISTINGS ★ A VERY MOVING EXPERIENCE (SEAN MCMANUS AND AMSTRAD COMPUTER USER) ★

A Very Moving Experience (Sean McManus and Amstrad Computer User)Coding Listings
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

Basic Animation is the game; Sean McManus is the name. Read on and pick up some important programming tips.

London by night - this is all you need to have seen to have the tools at your disposal for fast BASIC animation. But let's start with something simpler: junior school education.

Most of us have fond memories of making cartoons at school, by drawing two slightly different pictures, and then flicking rapidly between them. This is, in effect, two-frame animation - a cartoon made from two static pictures. To simulate this on the CPC we have to be able to 'flick' between two images on screen instantaneously. At this point, machine code programmers generally grin smugly, fold their arms and watch their BASIC counterparts wallow in failure.

The problem is that BASIC takes too long to draw a frame. Certainly any design worth animating would take at least several seconds to draw, shattering the illusion of motion. Perhaps we're approaching the problem the wrong way...

In mode 0 Oct's use this mode - the reason will become obvious later), you can have 16 different colours, including the 'background', from a possible 26, on screen at any given time. Pens are used to draw, and the pens are filled with INKS, using the INK command. If you're not familiar with these commands, now would be a very good time to reach for the manual. Pens can be made to flash by assigning two inks to them. The computer will automatically alternate the inks -changing all the occurances of the pen wherever it is on the screen. Instantaneously. Problem solved!

So, we can make the computer do our 'flicking' for us, by drawing our two images in different pens, and assigning the inks to flash. For example, if we have two frames, one drawn in pen one and the other drawn in pen two, we might assign the inks as follows:

INK 1,26,0:INK 2,0,26

This assumes that 0 is the background colour. Pen 1 will be 26 (bright white), while pen 2 is the background colour (hidden) .Then, pen 2 will become visible, as pen 1 is hidden. This 'flicking' between the images will continue until stopped, in the background of whatever else is happening.

Try DEMO I. It shows several animated jugglers. Upon running, you will be able to see the design as it appears in the default inks. Press any key to start. Parts of the design that are common to both frames are drawn in a pen which does not flash - it remains the same colour in both frames. As the scrolling message says, once the design is drawn, the computer can get on with other business, without interrupting the animation. The speed of the animation can be altered using the SPEED INK command. Can you imagine how painful it would have been to write this fairly simple demo without colour swapping?

10 ' Juggler - colour switching DEMO I
20 ' (C) 1991 Sean McManus
30 '

Whilst 'Roland on the Ropes' was deemed trendy in its day because thewords flashed different colours between loading blocks, we now know how to do some very interesting interblock animations, without too much effort.

But all this only allows for two-frame animation. Let's return to London (yes, wondering about that, weren't you?): Piccadilly Circus by night and its towering facades of neon advertising. Very effective. Yet, each individual panel is quite simple. Shaped tubes are lit and unlit, in sequence. This does not sound dissimilar to an approach we can adopt for animation on the CPC. Our tubes become lines and shapes, and our lighting is achieved by colour swapping. In Mode 0 we have 15 different colours (potential frames) at our disposal.

Enter Demo II. An animated Jack in the Box - a potential nightmare in BASIC - becomes quite simple by applying our'neon logic'. Upon running, inks (= frames) one to five are set to the background colours, to hide them while they are being drawn. Pen 8 is used to display a 'Please Wait' message, and our two-frame animation comes into its own with the little metronome that ticks away in front of us while the computer busies it self with the jack drawing. Each jack takes about 20 seconds to draw -well beyond the limit of normal animation. As it now stands, FOR-NEXT loops have been used to SLOW down its bounce! Note the technique of hiding a design in progress, to preserve its impact with spontaneity. Press any key to launch Jack, and another key to recall him. Repeat until bored, and then break. At the end, all the inks will be reset, revealing all frames.

10 ' Jack in the Box - DEMO II
20 ' (C) 1991 Sean McManus - 24th September
30 '

The Jacks are drawn from bottom to top, since they overlap and the top one must be the best. It is possible to plot the crossover points in a pen that is lit in both frames, and allow special programming for this. (See DEMO I's 'Juggle' text.) For an animation of this speed, it's hardly worth it.

These two programs demonstrate the power at the Basic programmer's fingers when he Thinks Neon' and uses colour swapping to bring screens alive.

Now, it's up to you. Work on your own designs, or pick and change on the two demos we've looked at here. If you're happy with the result, why not send it in to ACU for the crew to have a look at. The best piece of simple animation will be rewarded with a special ACU certificate, to boot.

So, get programming and let's see those demos soon.

ACU

★ PUBLISHER: Amstrad Computer User
★ YEARS: 1991 , 1992
★ AUTHOR: Sean Mcmanus
 

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listings:
» A  Very  Moving  Experience-Jack  in  the  Box-DEMO  II    (Amstrad  Computer  User)    ENGLISHDATE: 2023-12-02
DL: 12
TYPE: text
SiZE: 3Ko
NOTE:

» A  Very  Moving  Experience-Juggler-Colour  Switching  DEMO  I    (Amstrad  Computer  User)    ENGLISHDATE: 2023-12-02
DL: 14
TYPE: text
SiZE: 2Ko
NOTE:

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Coding Src's » Prenos Strojnih Programov na Disk (Moj Micro)
Je participe au site:
» Vous avez des infos personnel, des fichiers que nous ne possédons pas concernent ce programme ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 399 millisecondes et consultée 1404 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.