Set Monster Draw Order

Dirk

Member
Hi!

I want a monster to be always drawn on top. Now it is a hit and miss and my player sometimes gets correctly drawn behind the monster, but sometimes on top of the monster.
How can I force NESmaker to always draw one certain monster on top?
 

dale_coop

Moderator
Staff member
The "UpdateDrawOrder" subroutine from the HandleUpdateObjects.asm script (Basic\System folder) controls that...
You could modify to force that particular monster to be always on top.

But first, how to determine that monster? a unique monster id (only one monster object)? or he has a unique flag set? ...?
 

Dirk

Member
Thank you!
Hm, I want to make a peaceful monster group (family). Maybe it is possible to make the family group always draw on top? Do you know if there is an option to check the monster group's ID?
 

dale_coop

Moderator
Staff member
It would be difficult... don't know how to get it (and even if we can get it).

It woule easier to check the ID of the monster... or any flag or property of the monster... ?
Or if it's only on specific screens, you could usea screen flag or screen property... ?
 

dale_coop

Moderator
Staff member
For example, if your monster is the object #19 (the 4th monster of your monster objects list), you could modify the UpdateDrawOrder subroutine like this:

Code:
UpdateDrawOrder:
	
	LDX #$1
OrderLoop:

	LDY drawOrder,x
	LDA Object_y_hi,y
	STA temp
	;;;; what would drawOrder-1 be?  if it is 0, would would have to become 0f.
	
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;; dale_coop: the monster #19 will be always in front of all the other objects:
	LDA Object_type,y
	CMP #19
	BNE +
	LDA #$FF
	STA temp
	+
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	LDY drawOrder-1,x
	LDA Object_y_hi,y
	CMP temp
	BCS doneWithSwapItem
	LDA drawOrder,x
	STA drawOrder-1,x
	TYA
	STA drawOrder,x
doneWithSwapItem:
	INX
	CPX #TOTAL_MAX_OBJECTS
	BNE OrderLoop
	RTS
 

Dirk

Member
It works like a charm!

I replaced CMP #19 with CMP #$10 which seemingly corresponds to the first monster in my list.
 
Top Bottom