4.5 Monster Recoil Problems in Adventure Module and Possibly Others (FIXED)

TolerantX

Active member
I try to use recoil for MONSTERS and it seems not to work properly.
I did a fresh install and started a new project.
There is a video below to illustrate this.
What I'm doing is using a projectile to hit the enemy but it knocks them up or in some instances (I wasnt able to replicate this) the monster would no matter be knocked to the player... while this might be novel for a Mortal Kombat move maybe ;) it's far from adequate for an adventure or maze game.
by default the recoil on monsters is off. in physics its documented where you can enable it again by uncommenting skip physics. I do this in the vidoe and they knock up not the direction opposite to the player... what SHOULD happen is the recoil should knock them BACK, away from the point of impact aka IF they get hit in the front they go backward. if they get his in the back the move up, if the get hit in the right they move left etc.
How can we do this?

https://youtu.be/J14Ag4zKknI

FIXED: Make sure that if you are using recoil you have the stun state/step of the monster (the step the hurt monster goes to) isn't set to stop movement. Or If lacking a stun step the step the monster is in. STOP MOVEMENT prevents recoil. Thanks to JRotroid for helping with this!
 

Bucket Mouse

Active member
For me, dummying out that Skip Physics line didn't change anything at all -- there was no recoil whatsoever.
 

dale_coop

Moderator
Staff member
I just checked on my project...
Another way of doing that would be to implement a reverse direction in the hurtMonster script...

Instead of:

Code:
		ChangeActionStep temp, #$07
		LDA #$80
		STA Object_action_timer,x
		DEC Object_health,x
		LDA Object_health,x
		BNE +doSkipHurtingThisObject


You could do:

Code:
		;; reverse direction:
		TYA
		PHA
		LDA Object_direction,x
		AND #%00000111
		CLC
		ADC #$04
		AND #%00000111
		TAY ;; this is the "direction", where
			;; 0 = down, counterclockwise, 7=down-left
		LDA DirectionTableOrdered,y
		ORA FacingTableOrdered,y
		STA Object_direction,x
		PLA
		TAY
		
		;; then do the HURT animation state :
		ChangeActionStep temp, #$07
		LDA #$80
		STA Object_action_timer,x
		DEC Object_health,x
		LDA Object_health,x
		BNE +doSkipHurtingThisObject
 
Top Bottom