Accessing the second tileset in PPU Viewer

Here is the link to the wedNESday tutorial for making an Adventure game. Done something cool with it? Modified it in some way? Want to ask the community about creating additional features for it? Post things Adventure Module here!
Post Reply
nroflmao
Posts: 13
Joined: Mon Aug 13, 2018 3:07 am

Accessing the second tileset in PPU Viewer

Post by nroflmao » Sat Dec 01, 2018 8:35 pm

In the Adventure tutorial roughly around 1hour 18min mark, Joe starts talking about customizing the ASM to display sprites on the HUD.
Specifically he opens the Handle Sprite Pre-Draw script and adds code to write a sprite on the HUD.
I can replicate this by running FCEUX and opening the PPU Viewer and hovering over the tile i want to get the sprite ID.
However, there are two tile tables shown there and I can't figure out how to access the tileset on the right, it gives the same hex location as the table on the left.

Currently using the code below, I expect i need to modify the "#$2F" somehow to access the other tileset?

LDA weaponsUnlocked
AND #%00000001 ;; if weapons are unlocked and subpalette 1 ?
BEQ skipDrawingSwordInHud ;; go to skipDrawingSwordInHud
DrawSprite #$75, #$14, #$2F, #$00000000, spriteOffset
inc spriteOffset
inc spriteOffset
inc spriteOffset
inc spriteOffset
skipDrawingSwordInHud:
User avatar
Kasumi
Posts: 155
Joined: Fri Mar 09, 2018 11:13 pm

Re: Accessing the second tileset in PPU Viewer

Post by Kasumi » Sun Dec 02, 2018 12:40 am

One side is used for sprites, the other side is used for the backgrounds. (Generally.) You can't draw a background tile using sprites without changing to a thoroughly unsupported display mode. (8x16 sprites)

Tile #$2F is indeed different for the background and sprite sides, and the reason why you can't use tiles from one set in the other is because there is only one byte (with a range of 0-255), but there are 512 possible tiles. Therefore the byte will refer to only the tiles in one of the two sets. Changing it for one sprite means changing it for all sprites. (All of your sprites would be drawn with the background set.)

If you want to draw background tile, you'd create a new HUD asset as laid out in this timestamp https://youtu.be/wH6G296onhs?t=4556
If you want to add sprite tiles, you'd look at the timestamp you listed.



I take it the issue is that you want to add a tile that's not part of the HUD tileset? You can either add the tile you want (#$2F) to your sprite CHR, or add it to the HUD tiles. You can't easily use it from where it is.
nroflmao
Posts: 13
Joined: Mon Aug 13, 2018 3:07 am

Re: Accessing the second tileset in PPU Viewer

Post by nroflmao » Mon Dec 03, 2018 1:09 am

Thanks for the explanation, Kasumi! Now I understand. I will probably add my HUD sprite then to the other tileset so i can access it.
Post Reply