[comp.sys.atari.8bit] Joystick Problems

dddean@bluemoon.uucp (David D. Dean) (02/19/91)

Hello :-)

        I have been experimenting with Atari 8-bit BASIC and the joystick 
routines.  I have gotten to the point where I can move an object around 
the screen, and can locate the an item that might come into it's path.  

Now I would like for the jostick to pass over many items, and replace them 
after it moves over it.  Say that I have an "l" poked to look like a 
heart, after the joystick passes over the heart, it would re-appear.  

I have a problem in that the cursor leaves a trail behind it, covering 
over anything in it's path with the current shape of the cursor.

Thanks... and if that made sense.. please reply!


David D. Dean, President       "Living in a 3-D world."
Explorer Post 891
AT&T Bell Laboratories          Columbus, Ohio
dddean@bluemoon.uucp

**** Any opinions are that of the author, and NOT of AT&T ****

norlin@uokmax.ecn.uoknor.edu (Norman Lin) (02/20/91)

dddean@bluemoon.uucp (David D. Dean) writes:

>Hello :-)

>        I have been experimenting with Atari 8-bit BASIC and the joystick 
>routines.  I have gotten to the point where I can move an object around 
>the screen, and can locate the an item that might come into it's path.  

>Now I would like for the jostick to pass over many items, and replace them 
>after it moves over it.  Say that I have an "l" poked to look like a 
>heart, after the joystick passes over the heart, it would re-appear.  

>I have a problem in that the cursor leaves a trail behind it, covering 
>over anything in it's path with the current shape of the cursor.

>Thanks... and if that made sense.. please reply!

I haven't programmed the 8-bit in years, but the following should work.  You
may not be restoring the background explicitly, which you need to do.

10 GRAPHICS 1+16:REM or any other text mode
20 X=0:Y=0
30 LOCATE X,Y,Z:REM get "background"
40 POSITION X,Y:? #6;"l";:REM put your image on
50 IF (STICK(0)<>11 AND STICK(0)<>7) THEN 50
60 OLDX=X:IF STICK(0)=11 THEN X=X-(X>0)
70 IF STICK(0)=7 THEN X=X+(X<19)
80 POSITION OLDX,Y:? #6;CHR$(Z):REM ***********RESTORE THE BACKGROUND**********
90 GOTO 40

This simple example of course only works with left/right motion, but the
STICK(0) statements could easily be expanded.

Hope this helps...

>David D. Dean, President       "Living in a 3-D world."
>Explorer Post 891
>AT&T Bell Laboratories          Columbus, Ohio
>dddean@bluemoon.uucp

---|\-#-/_|-------/|-------,*.----||---Norman Lin, University of Oklahoma----
---|/-----|------/-|---,"--|---,"-||------norlin@uokmax.ecn.uoknor.edu-------
--/|------------/-*'---|/------|--||-----(IP addr: 129.15.[20|22|24].2)------
-|/|\---/_|-----|-----------------||-"I gazed in your eyes, and saw the moon-
--\|/-----|----*'-----------------||------------and the skies"---------------