| Posted: 04:38am 21 Oct 2023 |
|
|
|
Kevin, Volhout, I added a little function to translate the Game*Mite Buttons to K$. Can be extended to fire directions "BUT-A UP " etc as you wish. (Like the A&B = TAB)
'Controller to Keyboard translation '---joystick/Gamepad specific settings ' Settings for Game*Mite Sub init_game_ctrl Local i% ' Initialise GP8-GP15 as digital inputs with PullUp resistors For i% = 8 To 15 SetPin MM.Info(PinNo "GP" + Str$(i%)), Din, PullUp Next End Sub
Function contr_input$() If Not game_mite Then Contr_input$="":Exit Function Local n,ix% = Port(GP8, 8) Xor &h7FFF,cs$="",bit Local m$(7)=("DOWN","LEFT","UP","RIGHT","SELECT","START","BUT-B","BUT-A") ' which buttons are currently pressed For n=0 To 7 bit=2^n:If ix% And bit Then Inc cs$,m$(n)+" " Next Contr_input$=cs$ End Function
'>>>>>>>NEW<<<<<<<<<< 'Controller to Keyboard translation Function c2k$() Local c$,tmp$ c$=contr_input$() If c$<>"" Then If c$="DOWN " Then c2k$=Chr$(129) If c$="UP " Then c2k$=Chr$(128) If c$="LEFT " Then c2k$=Chr$(130) If c$="RIGHT " Then c2k$=Chr$(131) If c$="BUT-A " Then c2k$=" " If c$="BUT-B " Then c2k$="z" If c$="START " Then c2k$="m" If c$="BUT-B BUT-A ")Then c2k$=Chr$(9) EndIf End Function
just add this function call at the Position in the SourceCode, where Keyboard is read
... 'main player input loop ----------------------------------------- Do 'player input through keyboard, clearing buffer, check loop time k$="":Text 290,0,Right$("00"+Str$(Timer,3,0),3) Do tmp$=Inkey$ If tmp$<>"" Then k$=tmp$ 'keep last valid key
Loop Until Timer>h_beat Timer =0 '>>>>>>>>>>>>>>>>ADD HERE<<<<<<<<<<<<<<<<<<<<<<< If Game_Mite And k$="" Then k$=c2k$() '----------------------- ky=Asc(k$)
'player controls movement of player character
also add it in the Intro then the Game*Mite gets mobile Edited 2023-10-21 14:58 by Martin H. |