I've a request for TI BASIC and EXTENDED BASIC.
I need to learn a routine for control two object on screen in idependent movement, char or sprite, in CALL KEY and CALL JOY.
I try but 2nd control freeze 1st.
Please help me!
Jump to content
Posted Mon Apr 9, 2018 4:15 PM
100 CALL CLEAR 110 CALL MAGNIFY(2) 120 CALL SPRITE(#1,65,3,90,60) 130 CALL SPRITE(#2,66,7,90,180) 140 REM MAIN LOOP HERE 150 CALL JOYST(1,X,Y) 160 CALL MOTION(#1,-Y*2,X*2) 170 CALL JOYST(2,X,Y) 180 CALL MOTION(#2,-Y*2,X*2) 190 GOTO 140
Posted Mon Apr 9, 2018 7:10 PM
At Fest West this year I will show you my new routines.
Not only does it move the sprite per the joystick movements and returns those values of the
sprite and joystick use, but also does a keyboard scan and the fire button using a GOTO
100 CALL CLEAR 110 CALL SPRITE(#1,65,2,9,190,20,0) 120 CALL JOYMOTION(1,X,Y,#1,9,K) GOTO 150 130 PRINT X;Y,K 140 GOTO 120 150 PRINT "FIRE BUTTON" 160 GOTO 120
In RXB this gives a single routine that does joystick sprite and key fire button in one single GPL command.
A really cool feature is the ability to not use the GOTO or KEY routine and just JOYSTICK
100 CALL CLEAR 110 CALL SPRITE(#1,65,2,9,190,20,0) 120 CALL JOYMOTION(1,X,Y,#1,9) 130 PRINT X;Y 140 GOTO 120
Or just eliminate the GOTO and keep KEY
100 CALL CLEAR 110 CALL SPRITE(#1,65,2,9,190,20,0) 120 CALL JOYMOTION(1,X,Y,#1,9,K) 130 PRINT X;Y,K 140 GOTO 120
Edited by RXB, Mon Apr 9, 2018 7:15 PM.
Posted Mon Apr 9, 2018 7:27 PM
Posted Mon Apr 9, 2018 10:34 PM
I have a routine that I have been using in my own programs which runs surprisingly quickly in TI BASIC and even faster in TI Extended BASIC.
The source snippet is in Tidbit. The UserInput routine requires P for the player number to scan which equates to the KEY unit and JOYST unit to scan. If P is negative then only JOYST is scanned. You might squeeze a little extra performance by removing the negative P options which would be the IF P<0 test, and replacing ABS(P) where it occurs with just P.
After a GOSUB UserInput you will use the return value of J to determine sprite motions.
If you are interested in working in another BASIC language, RXB has a new command which takes joystick scans and directly translates them to sprite motions.
OMG very cool!
In RXB 2018 (or RXB 2019) multiple JOYMOTION could look like this:
CALL JOYMOTION(1,X1,Y1,SPRITE1,INDEX,KEY1,2,X2,Y2,SPRITE2,INDEX,KEY2) GOTO Line#1,Line#2
After KEY1 is Joystick 2 scan so the GOTO Line#1 is for Fire button 1 and Line#2 is Fire button 2
Edited by RXB, Mon Apr 9, 2018 10:35 PM.
Posted Tue Apr 10, 2018 10:23 AM
I've solved so in XB:
The keys are "E" and "X" for SX keyboard, with "O" and ","(comma) for DX keyboard.
Edited by gekido_ken, Tue Apr 10, 2018 10:33 AM.
0 members, 0 guests, 0 anonymous users