Subject: SPRITE question

From: Owen Brand <[email-masked]>
Date: Mon, 24 May 2010 03:04:30 -0400

I want to keep my SPRITE travelling only on pre-set screen  
characters.  Imagine a "road" or line of characters on the screen,  
going across the screen on row 3.  Let's say the character # of said  
road is "96".  If the SPRITE stays on that particular character  
number, all is well... But we do not want it to go onto...  
Say---"32".  Would the following pseudo-example work for this?

 >BEGIN
CALL POSITION(#1,XPOS1,YPOS1)
CALL JOYST for motion
CALL LOCATE the SPRITE 1 screen position in the direction specified by  
the user
CALL POSITION(#1,XPOS2,YPOS2)
CALL GCHAR(INT(XPOS/8),INT(YPOS/8),A)
IF A=96 THEN GOTO BEGIN ELSE CALL LOCATE(#1,XPOS1,YPOS1):: GOTO BEGIN

This should find original position (XPOS1,YPOS1) and then accept  
input. Then move the SPRITE one screen position in the specified  
direction.  Immediately following that, the program should check the  
position upon which the SPRITE NOW sits (XPOS2,YPOS2) and compares the  
screen character to "96.". If all is well, the program loops back to  
the beginning, starting over--and the new position becomes  
XPOS1,YPOS1. If the GCHAR returns a different number, the SPRITE will  
be moved back into it's original position and the loop starts again at  
">BEGIN"

Is this terribly inefficient?  Im hoping to get a decent demo up and  
running in XB for this current game project before I move onto  
assembly development of the project.  Any help, modifications,  
corrections, input, advice etc will be greatly appreiated.  Thanks!!

Owen Brand

        **webmaster**
http://www.Opry99er.com

---

From: "kabldb" <[email-masked]>
Date: Mon, 24 May 2010 08:40:22 -0000

I would do it like this

Read joystick
Calculate new position (based on old position, do not move sprite and do not overwrite old position)
Check new position
If okay then move sprite (and copy new position to old position)
Repeat

:-)