A89: Grayscale Sprites and Pointers...


[Prev][Next][Index][Thread]

A89: Grayscale Sprites and Pointers...




Okay, help me here. I want to have a pointer point to a sprite, then be able 
to add a number to that pointer to make it point to another sprite (i know 
how to do it in ASM, but not in C). Tell me if the code I have below will 
work, and if not, please correct it. Thanks.

/* includes */
void _main(void)
{
static char ball_plane0 = { 0x3C,
 0x42,
 0x99,
 0xA5,
 0xA5,
 0x99,
 0x42,
 0x3C};

static char ball_plane1 = { 0x00,
 0x3C,
 0x7E,
 0x66,
 0x66,
 0x7E,
 0x3C,
 0x00};

char *ball=ball_plane0;
void *plane0, *plane1;

if(!GrayMode(GRAY_ON)) return;
plane0=GetPlane(0);
plane1=GetPlane(1);
SetPlane(0);
ClrScr();
SetPlane(1);
ClrScr();
Sprite8(0,0,8,ball,plane0,SPRT_XOR); /* put ball_plane0 on plane 0 */
Sprite8(0,0,8,ball+8,plane1,SPRT_XOR); /* put ball_plane1 on plane 1 */
ngetchx();
GrayMode(GRAY_OFF);
}



Follow-Ups: