(SOLVED KIND OF) 4.5.9 Help with Monster Recoiling left

9Panzer

Well-known member
Hey Folks,
got another one. I'm building a larger boss with sprites to serve as the "weak spots". But the weak spots run away when they are hit. It wants to run left when it gets whacked rather then sitting still.
I think there is another script in the Metroidvania module that is driving this one outside of the hurtmonster script.

Anyone have any idea where I can find it?

 

9Panzer

Well-known member
The issue appears to be something to do with Action state 7 on the monster if that helps?
 

Jonny

Well-known member
I believe all the recoil stuff is in the doHandlePhysics.asm but maybe look in the handle monster hurt one too. Sorry I don't know how to fix it but I'm pretty sure thats where recoil is mostly controlled. I tried sorting the player recoil to no avail. There seems to be code all over to do with player recoil and its not that easy to just remove it. Monsters might be easier, not sure.

Unless after action 7, you're advancing to a 'move left' action?
 

9Panzer

Well-known member
Hey @Jonny ,
unfortunately The action step First thing I tried . I didn't even think of the physics though - I'll look into that tonight.
I was digging in the object collisions and the monster hurt but didn't see anything that made sense in there.

Thanks!
 

9Panzer

Well-known member
Alright I found the Recoil stuff on line 166 of the DoHandlePhyics.asm like you mentioned @Jonny , when I started playing with it it definitely effected the eyeball. But it seems to effect the player as well. Is there a line I can add that will force it to only effect the player and not the monster? I'm not quite ready to tackle the player recoil stuff yet.

;;;; THESE CONSTANTS WILL DETERMINE THE SPEED OF RECOIL
;;;; THE HURT STATE DURATION
RECOIL_SPEED_HI = #$00
RECOIL_SPEED_LO = #$00
HURT_DURATION = #$02


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 #RECOIL_SPEED_LO
STA Object_h_speed_lo,x
LDA #RECOIL_SPEED_HI
STA Object_h_speed_hi,x
 

Jonny

Well-known member
Alright I found the Recoil stuff on line 166 of the DoHandlePhyics.asm like you mentioned @Jonny , when I started playing with it it definitely effected the eyeball. But it seems to effect the player as well. Is there a line I can add that will force it to only effect the player and not the monster? I'm not quite ready to tackle the player recoil stuff yet.
Sounds like you're getting somewhere. I don't have a lot of time available at the moment to test this but you could try setting up one of the action step flags in monster object settings...

So where Joe has commented about caveats you could try something like...

Code:
LDX #$01                      ;; LOAD OBJECT INTO X            ;;
LDA Object_vulnerability,x    ;; LOAD VULNERABILITY BYTE       ;;
AND #%00000010                ;; ACTION STEP FLAG  2           ;;
BEQ +doRecoil                 ;; FLAGGED SO RECOIL             ;;
JMP +skipRecoil               ;; DONT RECOIL / JUMP THAT CODE  ;;
+doRecoil:


;;;; ALL THE RECOIL CODE ;;;;


+skipRecoil

I'll try to get back to this and text ASAP but for now this could be something you can work with. Another member might be able to correct anything that's wrong. I have a feeling that the first line might not be needed but not sure without spending some more time on it.

I hope this helps a bit.
 

9Panzer

Well-known member
Thanks @Jonny - I came up with a workaround. So I found the script for a Monster Barrier tile that @UltraNarwhal put together:

;; MONSTER BLOCK
LDA Object_flags,x
AND #%00001000 ;; is it a monster?
BEQ skipMonsterBlock;; skip monster block if not a monster
LDA ObjectUpdateByte
ORA #%00000001
STA ObjectUpdateByte ;; makes solid
skipMonsterBlock:
RTS

So I placed the barrier tiles on the monsters and they can't move anyone lol. Its not perfect but it works.

 
Top Bottom