RE: A89: Programming Problem


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

RE: A89: Programming Problem




Crap I pretty sure I was wrong. I thought someone told me this before or
something that is why I said it :) I have no idea.
Sorry

-----Original Message-----
From: owner-assembly-89@lists.ticalc.org
[mailto:owner-assembly-89@lists.ticalc.org]On Behalf Of Brady Simon
Sent: Friday, June 09, 2000 11:55 AM
To: assembly-89@lists.ticalc.org
Subject: RE: A89: Programming Problem



This is probably because you are defining the sprite, "ball" as an Int.
Int's are 16 bits long not 8, thus leaving 8 blank pixels to the left of it.
Change it to a char instead like the fallowing.

static unsigned char ball [] = {0x3c, 0x7e, 0xff, 0xff, 0xff,
0xff, 0x7e, 0x3c};

BTW: What program did you use to convert your sprite into C code?
I hope this helps.
-Brady

-----Original Message-----
From: owner-assembly-89@lists.ticalc.org
[mailto:owner-assembly-89@lists.ticalc.org]On Behalf Of Nathaniel Gibson
Sent: Friday, June 09, 2000 10:25 AM
To: assembly-89@lists.ticalc.org
Subject: A89: Programming Problem



I wrote the program below just to see if I could get a ball to bounce
around the screen. Everything works except for when the ball hits the
left side of the screen: it looks like it hits 8 pixels too soon. Can
someone please tell me what I'm doing wrong? I think it has something
to do with the way Sprite16 processes the sprite, but I'm not sure.


Thanks in advance,

Nathaniel Gibson
ngibson@ptd.net


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

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

int _ti89;


int _main()
{
	static unsigned int ball [] = {0x3c, 0x7e, 0xff, 0xff, 0xff,
0xff, 0x7e, 0x3c};
	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 == 143))	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;
}





References: