I'm trying to implement chronicleroflegends' boss code (http://www.nesmakers.com/viewtopic.php?f=40&t=2298), and I noticed that my constants for everything having to do with recoil, invulnerability, and hurt timer have no effect on my game, in that if I go into Project Settings->User Constants and change the values, it has no effect. Then I remembered that I was tweaking all that stuff in the HandlePlayerHurt script, since it seems to just define the value of those constants at the beginning of the script.
I figured I could comment these line out:
HURT_TIMER = #$16
INVINCIBILITY_TIMER = #$16
RECOIL_SPEED_HI = #$02
RECOIL_SPEED_LO = #$02
And maybe that would fix it. But it just gives me a really short recoil and hurt/invincibility timer, regardless of what values I set in Project settings.
Here is the script. It's the only place I've seen that seems to directly define constants in the code. Maybe there's somewhere else?
I figured I could comment these line out:
HURT_TIMER = #$16
INVINCIBILITY_TIMER = #$16
RECOIL_SPEED_HI = #$02
RECOIL_SPEED_LO = #$02
And maybe that would fix it. But it just gives me a really short recoil and hurt/invincibility timer, regardless of what values I set in Project settings.
Here is the script. It's the only place I've seen that seems to directly define constants in the code. Maybe there's somewhere else?
Code:
;;; assumes myHealth variable
;;; if a different variable should handle health
;;; change thename of myHealth.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; uses timers set in GameData\Constants:
;;OBJECT TIMERS
HURT_TIMER = #$16
INVINCIBILITY_TIMER = #$16
RECOIL_SPEED_HI = #$02
RECOIL_SPEED_LO = #$02
;;;; 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 #$06,#$02 ;; uses idle for hurt state.
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: