AMOS - The Creator User Guide - eBook-ENG

Page 157

II II II II II II II II II II II II

11 : Hardware sprites One of the biggest attractions of the Commodore Amiga is its ability to produce high quality games which rival those found on genuine arcade machines. This can be amply demonstrated by terrific programs such as Battle Squadron and Eliminator. Now, for the first time, all these amazing features are at your fingertips! AMOS Basic provides you with complete control over the Amiga's hardware and software sprites. These sprites can be effortlessly manoeuvred with the built-in AMAL animation language, so you don't have to be a machine code wizard in orderto create your own stunning arcade games. Hardware sprites are separate images which can be automatically overlayed on the Amiga's screen. The classic example of a hardware sprite is the mouse pointer. This is completely independent of the screen, and works equally well in all the Amiga's graphics modes. Since sprites don't interfere with the screen background, they are perfect for the moving objects required by an arcade game. Not only are they blindingly fast, but they also take up very little memory. So when you're writing an arcade game, hardware sprites should always be at the top of your list. Each sprite is 16 pixels wide and up to 255 pixels high. The Amiga's hardware supports a maximum of eight three-colour sprites or four fifteen-colour sprites. Colour number zero is transparent - that's the reason for the odd colour ranges. At first glance, these features don't seem particularly impressive. But there are a couple of useful tricks which can increase both the numbers and sizes of these sprites beyond recognition. One solution is to take each hardware sprite and split it into a number of horizontal segments. These segments can be independently positioned, allowing you to apparently display dozens of sprites on the screen at once. Similarly, the width restriction can be exceeded by building an object out of several individual sprites. Using this technique it's easy to generate objects up to 128 pixels wide. Until recently the only way to exploit these techniques was to delve into the mysterious world of 68000 assembler language. So you'll be delighted to discover that AMOS Basic manages the entire process automatically! Once you've designed your sprites with the AMOS sprite editor, you can effortlessly manipulate them with just a single Basic instruction.

The sprite commands Remember to have a sprite bank loaded into memory when trying out the various commands in this chapter. We advise you use the file SPRITES.ABK from the AMOS data disc.

SPRITE

(Display a hardware sprite on the screen)

SPRITE n,x,y,i

II

The SPRITE command displays a hardware sprite on the screen at the coordinates x,y using image number i. N is the identification number of the sprite and can range from 0 to 63. Each sprite can be associated with a separate image from the sprite bank, so the same image can be

II

145


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.