tbizzle
Well-known member
Here is a Macro, "CountGameObjects", that will count a specific Game or Monster Object by checking it's Monster #ID. The Macro "CountObjects" that is already included in NESmaker on the other hand will count Objects by checking them for their specific flag or flags. I needed a Macro that would just count the specific Monster/Game Object, so I modified the old Macro by replacing Line 16, which is this:
With this:
It's pretty simple, but is exactally what i needed with all the weapon objects I have included in my game. So if you need it, add this asm to your macros folder:
And use the Macro in your code like this:
Enjoy!
Code:
LDA Object_flags,x
With this:
Code:
LDA Object_type,x
It's pretty simple, but is exactally what i needed with all the weapon objects I have included in my game. So if you need it, add this asm to your macros folder:
Code:
MACRO CountGameObjects arg0
;; arg0 - Which # Game/Monster Object needs counted?
LDA arg0
STA tempA
TXA
PHA
TYA
PHA
LDA #$00
STA temp
LDX #$00
countObjectLoop:
LDA Object_status,x
AND #%10000000
BEQ +skipCountingThisObject
LDA Object_type,x
AND tempA
BEQ +skipCountingThisObject
INC temp
+skipCountingThisObject
INX
CPX #TOTAL_MAX_OBJECTS
BNE countObjectLoop
PLA
TAY
PLA
TAX
LDA temp ;; now the accumulator holds the number of that type of object still activated.
ENDM
And use the Macro in your code like this:
Code:
CountGameObjects #$00
Enjoy!
Last edited: