Barry2
Member
Here is the code that I'm using for my monster hurt script. As of now my "hurt" for action step 7 is my death animation for my monster. I only have a 1 hit kill for this game so far but this is how I got it working. I have not added sound yet but that is something that i will be adding later. This is for Metromania 4.5.9. For those that are having a hard time with this as I did, my monster death animation is 6, which is #$06 in the code under ,CreateObjectOnScreen, you can put any number you like for your game I just happen to use #6. Please see that photo attached. Please remember that it starts with 0 not 1.
I am using Metromania platform 4.5.9 for this code.
I hope this helps someone out there
I am using Metromania platform 4.5.9 for this code.
I hope this helps someone out there
Code:
TXA
STA temp
GetActionStep temp
CMP #$07 ;; we will use action step 7 for hurt.
BNE +doNotSkipHurtingThisObject;;; if he is hurt, he cant be hurt again
JMP +doSkipHurtingThisObject
+doNotSkipHurtingThisObject:
ChangeActionStep temp, #$07
LDA #$80
STA Object_action_timer,x
DEC Object_health,x
LDA Object_health,x
BEQ +doNotSkipHurtingThisObject
JMP +doNotSkipHurtingThisObject
+doNotSkipHurtingThisObject:
LDA Object_x_hi,x
CLC
ADC #$04
STA tempA
LDA Object_screen,x
ADC #$00
STA tempD
LDA Object_y_hi,x
CLC
ADC #$04
STA tempB
LDA Object_direction,x
AND #%00000111
STA tempC
DestroyObject
CreateObjectOnScreen tempA, tempB, #$06, #$00, tempD
CountObjects #%00001000
BNE +notZeroCount
LDA scrollByte
ORA #%00000010
STA scrollByte
;;;if there are no more monster left, we want to disable
;;; the edge check for scrolling
;LDA screenflag00
AND #%11101111
;STA screenflag00
+notZeroCount:
+doSkipHurtingThisObject