A89: Programming Problem Using Sprite16


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

A89: Programming Problem Using Sprite16




Zeljko,

I'm attempting to write a simple program that makes an 8x8 sprite 
shaped like a ball bounce around an empty screen on the TI-89. The 
code for what I have done so far is below. My problem is that the 
ball seems to have a 3-4 pixel wide line growing out of the side of 
it as it moves around the screen. Is this something wrong with 
Sprite16, or something wrong with my code?

Thanks in advance,

Nathaniel Gibson
ngibson@ptd.net

P.S. FYI: you'll receive this message twice because I CCed it to the 
Asm-89 list.

------------------------CODE-------------------------
#define SAVE_SCREEN

#include <nostub.h>
#include <graph.h>
#include <system.h>
#include <sprites.h>

int _ti89;


int _main()
{
	static unsigned int ball [] = {0x3c00, 0x7e00, 0xff00, 
0xff00, 0xff00, 0xff00, 0x7e00, 0x3c00};
	int key, x = 50, y = 50, xChange = 1, yChange = 1;
	void *kbq = kbd_queue ();
	long int j;

	ClrScr ();

	while (OSdequeue (&key, kbq))	{

		if ((x == 0) || (x == 151))	xChange *= -1;
		if ((y == 0) || (y == 91))	yChange *= -1;

		x += xChange;
		y += yChange;

		Sprite16(x, y, 8, ball, LCD_MEM, SPRT_XOR);
		for ( j = 0; j <= 50000; j++) ;
		Sprite16(x, y, 8, ball, LCD_MEM, SPRT_XOR);
	}

	return 0;
}



Follow-Ups: