A small tutorial to show how to implement the Holding B to Run in your projects.
The principle is simple, we'll modify the Physics to modify the speed when B is pressed.
INSTRUCTIONS
Modify your Handle Physics script (you can find it in the "Project Settings > Script Settigns" under "SubRoutines").
Find those exact lines in the script (around line 110 or 270 or 280 depending of the module used):
And replace those lines with:
Voilà, that's it.
The principle is simple, we'll modify the Physics to modify the speed when B is pressed.
INSTRUCTIONS
Modify your Handle Physics script (you can find it in the "Project Settings > Script Settigns" under "SubRoutines").
Find those exact lines in the script (around line 110 or 270 or 280 depending of the module used):
Code:
LDY Object_type,x
LDA ObjectMaxSpeed,y
ASL
ASL
ASL
ASL
;AND #%00001111
STA myMaxSpeed
LDA ObjectMaxSpeed,y
LSR
LSR
LSR
LSR
STA myMaxSpeed+1
And replace those lines with:
Code:
LDY Object_type,x
LDA ObjectMaxSpeed,y
STA tempA
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; if holding B
CPX player1_object
BNE +skip ;; if not the player object, we skip
LDA gamepad
AND #%00000010 ;; B button
BEQ +skip
LDA tempA
ASL ;; double the speed
STA tempA
+skip:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LDA tempA
ASL
ASL
ASL
ASL
;AND #%00001111
STA myMaxSpeed
LDA tempA
LSR
LSR
LSR
LSR
STA myMaxSpeed+1
Voilà, that's it.