[comp.sys.amiga] I've Got Sprite Troubles

dmg@ssc-vax.UUCP (David Geary) (02/11/88)

I have a Simple Sprite which looks like a small white ball.
I want to move the sprite around on the screen.

So:

1)  I open a custom screen with a custom bitmap.
2)  I open a window in the screen.

Then I call GetSprite() to get a sprite to play with.  To
move the sprite, I call MoveSprite().

Everything works great, meaning my screen and window
open properly, my call to GetSprite() succeeds, and
my sprite appears onscreen.

However, when I move the sprite (ball) around on the 
screen, the previous image of the sprite does not
completely disappear before the sprite is redrawn
at the new position.  As a matter of fact, at
a higher speed, I can distinctly see 3 images
at once.

I should also note that I can move the mouse
pointer around on the screen right alongside
the ball(sprite), and the mousepointer looks
perfect.

Can anyone help me?  I'm on an A1000, using
Lattice 3.03.  I *know* that my imagedata for
the sprite is correct, and that I'm using
GetSprite() and MoveSprite correctly.  The
cursor is a Simple Sprite, right?  Is it me?
My compiler?  Couldn't be the Amiga, right? -
I mean the cursor looks great, just my sprite
is messed up.

help,
     help,
          help...

  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~	"...You can't always get what you want..."	~
~			Rolling Stones			~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
***********************************************************
* David Geary, Boeing Aerospace Co., Seattle, WA 	  *
* I disclaim all disclaimers....			  *
***********************************************************

ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) (02/13/88)

In article <1669@ssc-vax.UUCP> dmg@ssc-vax.UUCP (David Geary) writes:
>However, when I move the sprite (ball) around on the 
>screen, the previous image of the sprite does not
>completely disappear before the sprite is redrawn
>at the new position.  As a matter of fact, at
>a higher speed, I can distinctly see 3 images
>at once.
>
>Can anyone help me?  I'm on an A1000, using
>Lattice 3.03.  [ ... ]
>^^^^^^^^^^^^^
>help,
>     help,
>          help...
>
	There's your problem right there :-).

	Seriously, I don't know what the problem is; I can only guess.  Have
some guesses:

	There are two possibilities that I can think of.  One is that you're
not moving the pointer fast enough.  You have to move it at least 15 frames
per second to eliminate most of the jittering effects.  Have you tried
writing a short standalone program that does nothing but move the pointer in
a tight loop, and see how that works?

	The other possibility is that you're moving the pointer *too* fast.
That is to say, your program is running so fast that your sprite location
data and hardware registers are being updated faster than the field rate.

	The hardware displays the sprite.  Meanwhile, you've updated the
position, and called MoveSprite() (which is really ChangeSprite() in
disguise).  The routine stomps the hardware sprite data register, and the
hardware starts DMA'ing from that point.  It sees the new position, waits
for the video beam to go there, and starts displaying it again.

	This seems highly implausible to me.  Nevertheless, are you using
WaitTOF() between each of your calls to MoveSprite()?

	Note that I'm just guessing.  I have a hard time believing the
problem exists at all, since I've never seen it before.  If these
suggestions don't work, I'd be willing to take a look at the executable.

_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Leo L. Schwab -- The Guy in The Cape	ihnp4!ptsfa -\
 \_ -_		Recumbent Bikes:	      dual ---> !{well,unicom}!ewhac
O----^o	      The Only Way To Fly.	      hplabs / (pronounced "AE-wack")
"Work FOR?  I don't work FOR anybody!  I'm just having fun."  -- The Doctor