LOADING...

SCREECH

Vintage & Modern Tech Blog

<5 Min *AGD* BASIC #3 - Stationary Sprites

November 13, 2017

Sprites can move in different directions across the screen

but, sometimes you may want a stationary sprite, as an
obstacle or decoration.

 

In the case of the following example, the sprite is acting
as smoke from a chimney.
 
For this tutorial you will need to open up the snapshot
entitled GiftHuntTutorial0001.sna.

 

 

If you don't have it already, head to the Loading Screech Downloads page and click on <5 Min BASIC ZX which contains the snapshot.

 

Once you have opened up the snapshot, navigate in AGD
to Events > Sprite type 4.


You should be looking at the following code;


IF A = 0
   ADD 1 TO G
   IF G = 4
   ANIMATE
   LET G = 0
   ENDIF
ENDIF

   


Explanation/Refresher
The purpose of A is to count every frame.


The usual sprite animation speed is too fast for a meandering chimney plume so, on the first frame (A=0, computers count from zero instead of one) 1 is added to a second variable, G.


Only when G=4 is the sprite animated by one frame.


After the type 4 sprite is animated, the G variable is returned to
0 and the count starts again.

 

 

Exercises
1. Delete everything in Sprite type 4 apart from;
IF A=0
   ANIMATE
ENDIF
Now run the game (Press X. on the main menu) and see how
the speed of the animation has changed.

 

Please reload

PLAY EXTENDED

  • YouTube Social  Icon

Custom Website Design and Content © 2014-2019 by Stephen Nichol. (Homepage theme in part inspired by 1992 issues of the computing magazine Your Sinclair). Articles, Captions, and Downloads by Stephen Nichol unless otherwise stated. Proudly created with Wix.com.

This site was designed with the
.com
website builder. Create your website today.
Start Now