What is going on with the RECOIL code in Adventure Base?!?! [4.5.9]

Kanbei85

Member
I'm absolutely stumped. I wanted to 'tone down' the recoil a bit, because in the stock configuration in Adventure Base, the recoil is excessive. Take one hit, and it sends you halfway across the screen.

I wanted to check if there was some easy way to tweak the amount of recoil in the code, and that place seemed to be in the PlayerHurt script, since there's a whole big long section of code there with comments talking about recoil.

But guess what? I've tried everything, and in desperation I wound up just commenting out the ENTIRE SECTION OF CODE. Still, nothing changed! What is all this seemingly useless code doing in the PlayerHurt script, and where is the REAL recoil code??

By the way, I did discover that the easiest way to get moderate, but not excessive, recoil is to set your hurt state to EndAction Loop and EndAnimation GoToFirst, and then make a 1-frame hurt animation with animation speed 2.

For apparently useless code, see below (nothing I did in this section of code seemed to have any effect on screen):

;; recoil
LDA #$00
STA Object_h_speed_hi,x
STA Object_h_speed_lo,x
STA Object_v_speed_hi,x
STA Object_v_speed_lo,x
LDA xPrev
STA Object_x_hi,x
LDA yPrev
STA Object_y_hi,x
+AlreadyInHurtState
LDA Object_x_hi,x
CLC
ADC self_center_x
STA tempA
LDA Object_y_hi,x
CLC
ADC self_center_y
STA tempB
TXA
PHA
LDX otherObject
LDA Object_x_hi,x
CLC
ADC other_center_x
STA tempC
LDA Object_y_hi,x
CLC
ADC other_center_y
STA tempD
PLA
TAX

;;; RECOIL
;;; find the center.
LDA tempA
SEC
SBC tempC
bpl +gotAbs ;; if positive, this is abs value
EOR #$FF
CLC
ADC #$01
+gotAbs
STA temp

LDA tempB
SEC
SBC tempD
bpl +gotAbs
EOR #$FF
CLC
ADC #$01
+gotAbs
;;; now abs of y is in A
CMP temp
BCC +recoilHor
;; recoil vert
LDA tempB
CMP tempD
BCS +recoilDown
LDA Object_direction,x
AND #%00001111
ORA #%00100000
STA Object_direction,x
JMP +skipHurt
+recoilDown
LDA Object_direction,x
AND #%00001111
ORA #%00110000
STA Object_direction,x
JMP +skipHurt
+recoilHor
LDA tempA
CMP tempC
BCS +recoilRight
LDA Object_direction,x
AND #%00001111
ORA #%10000000
STA Object_direction,x
JMP +skipHurt

+recoilRight
LDA Object_direction,x
AND #%00001111
ORA #%11000000
STA Object_direction,x
JMP +skipHurt
 
Last edited:

dale_coop

Moderator
Staff member
Open your Handle Physics script
Search for the RECOIL constant (and change the value ... you can try #$02 for example)
Also, the duration fo the recoil state is your action step 7... so, make it short (small timer or quick animation)
 
Open your Handle Physics script
Search for the RECOIL constant (and change the value ... you can try #$02 for example)
Also, the duration fo the recoil state is your action step 7... so, make it short (small timer or quick animation)
Thank you for pointing the way again1!!
 
Top Bottom