Making stomping monster observe monster's health instead of killing it immediately

Having trouble compiling code? Getting an unexpected error? Player not appearing on screen? Seeking answers on how to do a particular thing? This is the forum you're looking for, to ask other NESmaker users for assistance.
Post Reply
darkhog
Posts: 252
Joined: Sun May 13, 2018 10:02 am

Making stomping monster observe monster's health instead of killing it immediately

Post by darkhog » Thu Oct 04, 2018 10:13 pm

So this code in platform module handles how the monster is killed upon being stomped:

Code: Select all

LDX player1_object
	;TXA
	;STA tempx
	;JMP playerWasHurtDuringCollision
	;LDX player1_object
	LDA selfCenterY
	CMP otherCenterY
	BCS dontJumpOnMonster
	;;; JUMP ON MONSTER
	LDX player1_object
	LDA #$00
	SEC
	SBC #$04
	STA Object_v_speed_hi,x
	
	LDX tempx
	DeactivateCurrentObject
	LDY tempy
	;; INCREASE SCORE
	AddValue #$06, myScore, #$01, #$00
	;;;constant how many places, what variable, how much to change (0-9), what place to change (0=ones, 1=tens, etc etc etc)
	;;;; 
		LDA DrawHudBytes
		ora #HUD_myScore
		STA DrawHudBytes
It works and isn't buggy at all (as far as I've noticed), but I want it to observe monster health and hurt them instead of killing them instantly. Anyone knows what changes I have to make to this code to make it work? For anyone interested it's part of handle object collision script for platform module, starts on line 176
Post Reply