Cannot change animation in playerhurt or stop changing state back to 00 after flashing

drexegar

Member
It the player hurt script that is use here for scrolling module, it seems the animation action here doesn't do anything. If I change it nothing different happens, if I comment it out nothing different happens.

After the player flashes and the flash finishes, its force to go back to state 00 for a quick second, which sucks when crouching because the character gets up quickly.

;;; assumes myHealth variable
;;; if a different variable should handle health
;;; change thename of myHealth.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; uses timers set in GameData\Constants:
;;OBJECT TIMERS
;HURT_TIMER = #$08
;INVINCIBILITY_TIMER = #$08
;RECOIL_SPEED_HI = #$06
;RECOIL_SPEED_LO = #$00

;;;; To change invincibility time, knock back speed, or hurt duration
;;;; updating the abovevalues in constants.

LDA Object_health,x
SEC
SBC #$01 ;; subtract other's strength
CMP #$01
BCS notPlayerDeath

PlaySound #SND_HURT_PLAYER
JSR HandlePlayerDeath
JMP doneWithPlayerHurt

notPlayerDeath:
STA Object_health,x
STA myHealth

STA hudElementTilesToLoad
LDA #$00
STA hudElementTilesMax
; LDA DrawHudBytes
; ora #HUD_myHealth
; STA DrawHudBytes
UpdateHud HUD_myHealth
;; TURN ON handling the hud

LDA Object_status,x
ORA #%00000001
STA Object_status,x

LDA #HURT_TIMER
STA Object_timer_0,x
ChangeObjectState #$04,#$04 ;; uses idle for hurt state. ;This code right here! Doesn't do a damn thing! 04 is crouch, but I can change it to any number wont work anyway. even with a #00 at the second number.

LDA selfCenterX
STA recoil_selfX
LDA selfCenterY
STA recoil_selfY
LDA otherCenterX
STA recoil_otherX
LDA otherCenterY
STA recoil_otherY

JSR DetermineRecoilDirection


;;;;; SCROLLER CAN NOT MAKE USE OF UPDATING HUD THIS WAY.



doneWithPlayerHurt:
 

dale_coop

Moderator
Staff member
To prevent the player to goo back oto action step 0 when hurt, you need to make a small modification in the HandleUpdateObjects.asm script, like in this post: http://nesmakers.com/viewtopic.php?p=12343#p12343
 
Top Bottom