AMOS - The Creator User Guide - eBook-ENG

Page 172

WaitVbl ~~~~~~~ Bob Clear Rem Rem Now redraw any of your graphics which have changed. Rem Perform your game routines (Collision detection etc ...) Rem Update your Bob images Rem Bob Draw Rem Swap Physical and logical screens Until WIN: Rem Continue until the game has finished Note that this procedure will only work if there's a smooth progression from screen to screen. It's entirely up to you to keep the contents of the physical and logical screens in step with each other. An example of this technique can be found in EXAMPLE 12.4 Supposing for instance, you wanted to display a bob over a series of random blocks. You might try to use a routine like:

Load "AMOS_DATA:Sprites/Sprites.abk": Flash Off: Get Sprite Palette Double Buffer: Cis 0 : Autoback 0 : Update Off Bob 1,160,100,1 Do

~~

X=Rnd(320}+1 : V=Rnd(200}+1 : W=Rnd(80}+1 : H=Rnd(50}+1 : I=Rnd(15} Ink I: Bar X,V TO X+W,V+H Rem This would normally be a call to your collision detection routine Bob Draw Screen Swap: Wait Vbl Loop But since there's no relationship between the physical and logical screens, the display will now flick continuously from screen to screen. To overcome this problem, you'll need to mimic the original AUTOBACK system like so:

Load "AMOS DATA:Sprites/Sprites.abk": Flash Off : Get Sprite Palette Double Buffer: Cis 0 : Autoback 0 : Update Off Bob 1,160,100,1 Do

Rem Update first screen Screen Swap: Wait Vbl Bob Clear X=Rnd(320}+1 : V=Rnd(200}+1 : W=Rnd(80}+1 : H=Rnd(50}+1 : I=Rnd(15} Ink I : Bar X,V To X+W,V+H Bob Draw Rem Update second screen Screen swap: Wait Vbl Bob Clear Ink I: Bar X,V To X+W,V+H

160

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


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