Recoil Direction in brawler base (4.5.9)

IMBrendan

Member
Hey All,
I have been playing around with NES maker for a few weeks now and seem to be getting the hang of it thanks in large part to lurking on the forums.
That being said, I have run into a problem with creating a recoil for my Brawler game. Currently, the player doesn't recoil from monsters and when hitting "hurt" blocks the player is instead thrown across the screen in their walking direction. In both cases the player enters the hurt animation correctly. I figured out fairly quickly that code for these two types of hurt were in different locations (tiles and common scripts) and have entered the same code in the relevant sections of each.
ChangeActionStep player1_object, #$07
;; 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
+notAlreadyInHurtState
I've played around with this a little - but my limited knowledge of asm is showing.
Thanks for all your help,
Brendan
 

IMBrendan

Member
Okay - thanks to a ton of help from jorotroid in the discord I was able to bash my way into a solution for hurt tiles. I will be playing around with the script for monsters as I'm not sure if this solution will work there. For those interested, my current code looks like this.

ChangeActionStep player1_object, #$07
;; recoil

LDA Object_direction,x
AND #%01000000 ; this checks bit 7
BEQ +bitwasoff ; if the bit was off
JMP +bitwason
+bitwasoff


LDA #%11000000
STA Object_direction,x
JMP +skipHurt


+bitwason
LDA #%10000000
STA Object_direction,x

It still flings the sprite wildly across the screen - however it seems to do it in the correct direction, so I am at least please with that.
 
Last edited:
Top Bottom