Monster Recoil

mcmilstead

New member
If anyone is running into an issue where some of your monsters are recoiling, there's code somewhere that's causing that, but I'm not sure where. I've found a workaround that works for me. In the doHandlePhysics_PlatformBase script around line 160 is where you find your recoil speed. Right after that, you'll see the code that handles the recoil. You'll need to add some code in there that will check to see if the object is a player or not. Here's what I did.
-----------------------------------
;;;; THESE CONSTANTS WILL DETERMINE THE SPEED OF RECOIL
;;;; THE HURT STATE DURATION
RECOIL_SPEED_HI = #$02
RECOIL_SPEED_LO = #$00
HURT_DURATION = #$01


TXA
STA temp
GetActionStep temp
CMP #$07
BNE +notHurt
;;; this object is hurt.
;;; so it's speed will be determined by the recoil speed above.
;;; any caveats to that, put here. For instance, if there is a monster bit
;;; that prevents recoil.
LDA Object_type,x ;Check to see if the object is a player
CMP #00 ; this assumes your player is in slot #00
BNE +noRecoil ; if not your player skip recoil
LDA #RECOIL_SPEED_LO
STA Object_h_speed_lo,x
LDA #RECOIL_SPEED_HI
STA Object_h_speed_hi,x

+noRecoil
JMP gotHandVspeeds
+notHurt

--------------------------------------------------


I hope this helps someone. I struggled with this on my game for weeks.
 

dale_coop

Moderator
Staff member
hmm...
Maybe people wants their monsters to have a recoil when you hurt them (like it is for the Player).
In your project, you don't want that, I can understand. But it's definitely not a bug ;)
 

mcmilstead

New member
Yes, if they want the monster to recoil, but only some of my monsters were recoiling and when they did they’d shoot across the screen.
 

dale_coop

Moderator
Staff member
Yes, if they want the monster to recoil, but only some of my monsters were recoiling and when they did they’d shoot across the screen.
The speed of the recoil can be adjusted (modifying RECOIL_SPEED_HI anf RECOIL_SPEED_LO)
If not all your monsters are having the recoil, it might be an issue in your Handle Monster Hurt script or maybe the settings on your monster objects.
 
Top Bottom