tbizzle
Well-known member
Here is my solution for a breakable tile that once you break it and leave the screen, it will remain gone. Other breakable tiles will reappear after you leave the screen and come back, it won't be "triggered" and stay gone. So here is what we shall do:
Step 1: Enable Monster Bits into your project by following this tutorial: https://www.nesmakers.com/index.php?threads/4-5-9-adding-monster-bits-back-in.7682/#post-42944
Step 2: We need to create a "breakable Block". For this we will use a monster and we will make it 16x16 pixels. No need to give it any animation or AI steps, but give it a full 16x16 bounding box and make it look like a block you'd like to break. Also we will check its monster flag to "NPC".
Step 3: Next we need to go into "doHandleObjectCollisions.asm". Right around line 83, right underneath this bit of code
Insert this bit of code:
Now underneath this bit of code at around line 92:
Insert this last little line of code:
Now go to your breakable NPC tile and check its monster bits box to observe player weapon collision:
Next lets make this NPC breakable object not have text abilities either. To do this go to the "doDrawBox.asm" file. Right underneath this line of code at line 1
Insert this bit of code:
Now let us go back to our breakable NPC object and check this monster bit:
Now the NPC object will not be able to bring up NPC text. It will just act as a solid block, when collided with by a player weapon will be destroyed! Now to give it a destroy animation and trigger the screen so it stays destroyed when you leave the screen and come back. To do this go to "doHandleHurtMonster.asm". Right after
insert this bit of code:
Now the Breakable NPC object will reamain broken when you leave, then return back to the screen!
I hope you find this useful! Enjoy!
Step 1: Enable Monster Bits into your project by following this tutorial: https://www.nesmakers.com/index.php?threads/4-5-9-adding-monster-bits-back-in.7682/#post-42944
Step 2: We need to create a "breakable Block". For this we will use a monster and we will make it 16x16 pixels. No need to give it any animation or AI steps, but give it a full 16x16 bounding box and make it look like a block you'd like to break. Also we will check its monster flag to "NPC".
Step 3: Next we need to go into "doHandleObjectCollisions.asm". Right around line 83, right underneath this bit of code
Code:
LDA Object_status,x
AND #%10000000
BNE +isActive
JMP +skipCollision
+isActive:
Insert this bit of code:
Code:
LDY Object_type,x
LDA MonsterBits,y
AND #%00000100 ;;;;This bit is the top "check box/bit" for monster bits
BEQ NES
LDA Object_flags,x
AND #%10001000
JMP moooo
NES:
Now underneath this bit of code at around line 92:
Code:
LDA Object_flags,x
AND #%00001000
Insert this last little line of code:
Code:
moooo:
Now go to your breakable NPC tile and check its monster bits box to observe player weapon collision:
Next lets make this NPC breakable object not have text abilities either. To do this go to the "doDrawBox.asm" file. Right underneath this line of code at line 1
Code:
doDrawBox:
Insert this bit of code:
Code:
LDY Object_type,x
LDA MonsterBits,y
AND #%00000010 ;;;;This bit is the top "check box/bit" for monster bits
BEQ poot55
RTS
poot55:
Now let us go back to our breakable NPC object and check this monster bit:
Now the NPC object will not be able to bring up NPC text. It will just act as a solid block, when collided with by a player weapon will be destroyed! Now to give it a destroy animation and trigger the screen so it stays destroyed when you leave the screen and come back. To do this go to "doHandleHurtMonster.asm". Right after
Code:
DestroyObject
insert this bit of code:
Code:
LDA Object_flags,x
AND #%10000000
BEQ kid
CreateObjectOnScreen tempA, tempB, #$0F, #$00, tempD
TriggerScreen screenType
JMP +doSkipHurtingThisObject
kid:
Now the Breakable NPC object will reamain broken when you leave, then return back to the screen!
I hope you find this useful! Enjoy!
Last edited: