Portable Game Console
PoGa-4DGL Reference Manual
8. Creating and controlling sprites
#platform "PoGa-GOLDELOX"
// PoGa Sprite Demo
#inherit "4DGL_16bitColours.fnc"
// There are 2 functions associated with sprites:-
// 1]
//func gfx_SpriteSet("bitmaps", "colours", "palette"), 0;
// Syntax : gfx_SpriteSet("bitmaps", "colours", "palettes");
// Usage : gfx_SpriteSet(mysprites, colours, mypalete);
// Notes : 3 sets of data are required by the sprite generator,
// : this function sets the internal pointers for the 3 parts.
// : 1] the bitmaps for the sprites,
// : 2] the colour lookup table (CLUT),
// : 3] the 4 colour palettes.
// 2]
//func gfx_BlitSprite("spritenumber", "palette", "xpos", "ypos", "orientation"), 0;
// Syntax : gfx_BlitSprite("spritenumber", "palette", "xpos", "ypos", "orientation");
// Usage : gfx_BlitSprite(1,2,10,10,SOUTH); // example show a cherry upside down using
// the third palette of mypalette
// Notes : Places the required sprite bitmap at the origin xpos, ypos using the required 4
colour palette.
// : orientation determines in which direction the sprite will be displayed.
// sprite bitmap format:-
// Example sprite data, only 2 entry shown for clarity (128 max available)
// Each sprite is 32 words long.
// The first word (and subsequend even words) are pixel 1-8 of the line.
// The second word (and subsequent odd words) are pixels 9-16 of the line.
// The most significant pixel pair is the leftmost pixel.
// The least significant pixel pair is the rightmost pixel.
// Each pixel pair selects 1 of 4 colours from the selected pallette
// Each palette has one of 4 colours that are 'wired' to the CLUT (colour lookup table).
// Each sprite can be displayed with a different palette, allowing colour cycling
// and other special effects.
// part 1] the bitmaps for the sprites
#DATA
word mysprites
// 1) a box with a '+' in the middle
0xFFFF,0xFFFF, // line 1 3333333333333333
0x0003,0xC000, // line 2 3 3
0x0003,0xC000, // line 3 3 3
0x0003,0xC000, // line 4 3 3
0x4003,0xC001, // line 5 3 11 3
0x4003,0xC001, // line 6 3 11 3
0x4003,0xC001, // line 7 3 11 3
0x5503,0xC055, // line 8 3 1111111111 3
0x5503,0xC055, // line 9 3 1111111111 3
0x4003,0xC001, // line 10 3 11 3
0x4003,0xC001, // line 11 3 11 3
0x4003,0xC001, // line 12 3 11 3
0x0003,0xC000, // line 13 3 3
0x0003,0xC000, // line 14 3 3
0x0003,0xC000, // line 15 3 3
0xFFFF,0xFFFF, // line 16 3333333333333333
© 2011 4D Systems
www.4dsystems.com.au
Page 73 of 87