top of page

LOADING...

SCREECH

Vintage & Modern Tech Blog

  • Stephen Nichol

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


screenshot of AGD tutorial

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.

84 views

Related Posts

See All
bottom of page