How do I make a breakable block reveal a warp tile?

Post Reply
User avatar
cargo
Posts: 98
Joined: Mon Sep 03, 2018 4:34 am

How do I make a breakable block reveal a warp tile?

Post by cargo » Thu Dec 06, 2018 1:43 am

Sorry if this has been asked before but does anyone have an example of how to make a breakable block reveal a warp tile? As in for adding a hidden room (or a shop) for the player to explore. I am guessing the command in question is the macro ChangeTileAtCollision at BreakableBlock.asm, but don't know what parameters to include.
Happy Holidays

Image
User avatar
dale_coop
Posts: 1618
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: How do I make a breakable block reveal a warp tile?

Post by dale_coop » Thu Dec 06, 2018 8:58 am

In the "BreakableBlock.asm" script, at line 26, change the:

Code: Select all

	ChangeTileAtCollision #$00, underStomp
for:

Code: Select all

	ChangeTileAtCollision #$02, underStomp
Your broken block should now be a warp tile
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
chronosv2
Posts: 218
Joined: Wed Aug 08, 2018 9:30 pm
Location: KY, USA
Contact:

Re: How do I make a breakable block reveal a warp tile?

Post by chronosv2 » Thu Dec 06, 2018 3:41 pm

Dale's got the right answer there, but if you want breakable blocks to leave ground when you break them but have one reveal a warp you'll want to make a copy of the BreakableBlock script, make the change to the new script and make it a new tile type.
Modifying the code without making a copy first will make all breakable blocks reveal warp tiles.
Also you'll want to change underStomp to one of the other tile appearances you set up in the Assets sub-tree (like underSecret), or all breakable blocks will share the same destroyed appearance.
ASM/C# Coder -- Computer + Coffee = Code
ASM Tutorial Series
User avatar
dale_coop
Posts: 1618
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: How do I make a breakable block reveal a warp tile?

Post by dale_coop » Thu Dec 06, 2018 4:27 pm

chronosv2 wrote:
Thu Dec 06, 2018 3:41 pm
Dale's got the right answer there, but if you want breakable blocks to leave ground when you break them but have one reveal a warp you'll want to make a copy of the BreakableBlock script, make the change to the new script and make it a new tile type.
Modifying the code without making a copy first will make all breakable blocks reveal warp tiles.
Also you'll want to change underStomp to one of the other tile appearances you set up in the Assets sub-tree (like underSecret), or all breakable blocks will share the same destroyed appearance.
Oh yes, you right, chronosv2.

Code: Select all

	ChangeTileAtCollision #$02, underSecret
would be better.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
cargo
Posts: 98
Joined: Mon Sep 03, 2018 4:34 am

Re: How do I make a breakable block reveal a warp tile?

Post by cargo » Thu Dec 06, 2018 4:59 pm

Thanks for the help guys. Hex value #$02 is indeed the assigned ID for a warp tile in NESMaker's engine.

Now I have another problem:

+ The block only breaks when attacking horizontally from the left or the right.
+ The under tile appears at different locations (probably dependent on where the collision coordinates). I made a video about this as it is simpler to see it than to explain it:

https://www.dropbox.com/s/qdnrfviizooka ... e.mp4?dl=0

In the video I left the tile as null-walkable but if it were a warp tile the tile could potentially appear under the player and automatically change the screen. Is there a way to fix this? Better yet could we come up with a similar macro where we could pass the x, y coordinates of the specific tile on the screen?
Happy Holidays

Image
User avatar
chronosv2
Posts: 218
Joined: Wed Aug 08, 2018 9:30 pm
Location: KY, USA
Contact:

Re: How do I make a breakable block reveal a warp tile?

Post by chronosv2 » Thu Dec 06, 2018 6:45 pm

Unfortunately blocks not breaking properly is a known issue. I helped someone else create custom breakable block code and encountered the same problem. Hopefully 4.1.0 (which seems to be coming very soon) will fix this.
ASM/C# Coder -- Computer + Coffee = Code
ASM Tutorial Series
User avatar
cargo
Posts: 98
Joined: Mon Sep 03, 2018 4:34 am

Re: How do I make a breakable block reveal a warp tile?

Post by cargo » Thu Dec 06, 2018 7:20 pm

I don't mind being unable to break a block vertically but the incorrect pop up location of the under tile makes the feature unusable from my perspective. In my opinion the macro should use the coordinate of the breakable tile, not the location where it guessed the collision took place. It's not our fault of course but I find it interesting programming wise. Thanks again for the help.
Happy Holidays

Image
User avatar
chronosv2
Posts: 218
Joined: Wed Aug 08, 2018 9:30 pm
Location: KY, USA
Contact:

Re: How do I make a breakable block reveal a warp tile?

Post by chronosv2 » Fri Dec 07, 2018 2:32 am

It's an unfortunate quirk of how the current collision code works. The one thing that I do know is that it checks the four corners one at a time, and if any of the corners triggers a collision it executes the code. It's particularly noticeable with longer weapon collision boxes.
ASM/C# Coder -- Computer + Coffee = Code
ASM Tutorial Series
Post Reply