Portable Game Console
PoGa-4DGL Reference Manual
Final editable version of SpriteGhostDemo.4DG source code.
#platform "PoGa-GOLDELOX"
#inherit "4DGL_16bitColours.fnc" // we need to colour list for the sprites CLUT
#inherit "demoAnimation.inc" // inherit the demo sprite bitmaps
func main()
gfx_RectangleFilled(0,0,127,40,DARKGRAY); // set a background colour
gfx_SpriteSet(demoanimation_sprites, demoanimation_colors, demoanimation_palette); //
first, set the pointers for the sprite generator
gfx_BlitSprite(S_Cherry, P_Cherry, 56, 10, NORTH); // display the cherry sprite at
56,50
gfx_TransparentColour(BLACK);
gfx_Transparency(ON);
gfx_BlitSprite(S_Cherry, P_Cherry, 86, 10, NORTH); // display the cherry sprite at
86,50, transparently
gfx_BlitSprite(S_11_ghost_rightleft_1, P_Ghost1, 10, 100, NORTH); // display the
ghost, looking right
gfx_BlitSprite(S_12_ghost_rightleft_2, P_Ghost1, 30, 100, NORTH); // display the
ghost, looking right
gfx_BlitSprite(S_11_ghost_rightleft_1, P_Ghost1, 50, 100, NORTH_MIRRORED);// display the
ghost, looking left
gfx_BlitSprite(S_12_ghost_rightleft_2, P_Ghost1, 70, 100, NORTH_MIRRORED);// display the
ghost, looking left
var x, y;
gfx_Transparency(OFF); // transparency off so the black surround of the spright blanks its
trail
x := 10;
y := 70;
repeat
// walk right
repeat
gfx_BlitSprite(S_11_ghost_rightleft_1, P_Ghost1, x, y, NORTH); // display the
ghost, looking right
pause(40);
gfx_BlitSprite(S_12_ghost_rightleft_2, P_Ghost1, x, y, NORTH); // display the
ghost, looking right
pause(40);
x++;
until(x>=100);
// walk left
repeat
gfx_BlitSprite(S_11_ghost_rightleft_1, P_Ghost1, x, y, NORTH_MIRRORED); // display the
ghost, looking left
pause(40);
gfx_BlitSprite(S_12_ghost_rightleft_2, P_Ghost1, x, y, NORTH_MIRRORED); // display the
ghost, looking left
pause(40);
x--;
until(x<=10);
forever
repeat forever
endfunc
© 2011 4D Systems
www.4dsystems.com.au
Page 72 of 87