I am having difficulty with this piece of code (See Below)
It seems that if my character continually runs left (JLEFT) and then jumps(FIRE) the sprite shown is the character jumping right. however, it is not the case when the character is running right. If the character runs right (JRIGHT) and you jump (FIRE) then the sprite shown is of the character jumping right. Its strange because I can't seem to see what is wrong here. I'm quite new to stos and this is my first venture into sprite movement/manipulation. Any help on this would be appreciated. Thanks in advance...
This is a list of the following sprite numbers
| FACING RIGHT | FACING LEFT |
STATIONARY 1 7
RUNNING 2,3,4 8,9,10
TURNING 6 12
JUMPING 5 11
this is the code I'm currently using. Once again, Thanks for taking the time!
MisterMister
=========================================================================================
5 load "character.mbk"
10 cls : key off : curs off : hide : mode 0
20 D=palt(start(1)) : wait vbl
30 rem ****************************
40 rem ***** PLAYER VARIABLES *****
50 rem ****************************
60 PX=110 : PY=168 : PS=1 PX=left/right PY=up/down PS=spriter number
70 rem ****************************
80 rem ***** SET PLAYER ON SCREEN *****
90 rem ********************************
98 wait vbl
99 sprite 1,PX,PY,PS
100 if PS>6 then PS=7
101 if PS<6 then PS=1
110 rem ***********************************
120 rem ***** TEST JOYSTICK MOVEMENT *****
130 rem **********************************
140 if jleft then gosub 300
150 if jright then gosub 400
160 if fire then gosub 500
170 wait vbl
180 goto 98
297 rem ***************************
298 rem ***** PLAYER MOVES RIGHT *****
299 rem ******************************
300 if PS=1 then PS=7
310 repeat : wait vbl : inc PS : sprite 1,PX,PY,PS : until PS=10
320 return
397 rem ***************************
398 rem ***** PLAYER MOVES LEFT *****
399 rem ******************************
400 if PS=7 then PS=1
410 repeat : wait vbl : inc PS : sprite 1,PX,PY,PS : until PS=4
420 return
497 rem ***************************
498 rem ***** PLAYER MOVES UP *****
499 rem ******************************
500 if PS=7 then 550
510 PS=5
520 repeat : wait vbl : PY=PY-4 : sprite 1,PX,PY,PS : until PY=104
530 repeat : wait vbl : PY=PY+4 : sprite 1,PX,PY,PS : until PY=168
540 return
550 PS=11
560 repeat : wait vbl : PY=PY-4 : sprite 1,PX,PY,PS : until PY=104
570 repeat : wait vbl : PY=PY+4 : sprite 1,PX,PY,PS : until PY=168
580 return
====================================================================================================




