values for user constants

Having trouble compiling code? Getting an unexpected error? Player not appearing on screen? Seeking answers on how to do a particular thing? This is the forum you're looking for, to ask other NESmaker users for assistance.
Post Reply
User avatar
stevenshepherd
Posts: 236
Joined: Sun Feb 18, 2018 5:25 pm

values for user constants

Post by stevenshepherd » Sun Jan 13, 2019 3:26 pm

So I am struggling to figure out how the values of user constants correspond to, say, the sprites in my player object tileset. The defaults of (I believe 8-9 for horizontal and vertical melee weapon) were intuitive enough - just count left to right starting with zero, from the top left corner. I intuited that the second row in the second spot from the right would be 17 (where my horizontal melee weapon actually was) and so I changed the appropriate user constant to 17 and that seemed to work. But then I thought my vertical melee weapon was 33, and I just got an error when trying to run the game. So then I moved the sprite to what I thought was 12, and got an error. Then moved it to what I thought was 14, and it worked. So basically, I don't know the underlying values for each 8x8 sprite location on the tile sheet.

On FB, Joe suggested I "use the plug in to see dec - hex - bin conversions". After figuring out what he meant (plugin tab on left menu, not the separate plugin thing that was recently released), I am still stuck. It seems to convert numbers into hex, but Joe said "Yeah the CODE has to be written in hex, but the tool sees dec for those constants (and converts them to hex on export)". So, if the tool sees dec, then I am not sure why I need to know the hex. Similarly, I don't know the original hex values of the tile sheet if that is what is needed.

Any help is much appreciated :)
User avatar
dale_coop
Posts: 3555
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: values for user constants

Post by dale_coop » Sun Jan 13, 2019 3:46 pm

as you thought, it's just counting the (8x8) tiles from 0 to 127 (from left to right, top to bottom).
Could you share a screenshots of your GameObjectTiles.bmp?
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
User avatar
Mugi
Posts: 510
Joined: Thu Dec 27, 2018 8:30 pm

Re: values for user constants

Post by Mugi » Sun Jan 13, 2019 3:56 pm

in a tile sheet, each 8x8 tile represents 01 in hex.

each row has 16 tiles, starting from 00

the first tile in a tile sheet is 00, the last tile of the first row is 0F
the first tile of the second row is 10

each row increments the number by 10 (in hex, so 16) and each column increments it by 01

it has to be understood when calculating tile offsets, that the tilesheets exists sequentially in the rom, so when you go past the last tile of a tile sheet, you will end up in the first tile of the next tile sheet.

for example, the last tile of the gameobjects sheet is 7F, so if you draw tile 80, you are actually drawing the first tile of the first row in the monster tile sheet.

this is confusing because we're all used to the fact that the GUI representation when drawing level assets are 16x16, but the engine actually counts tiles by 8x8
User avatar
stevenshepherd
Posts: 236
Joined: Sun Feb 18, 2018 5:25 pm

Re: values for user constants

Post by stevenshepherd » Sun Jan 13, 2019 4:49 pm

Thanks both of you!

Here is the file for dale:
player tile sheet issues.png
player tile sheet issues.png (168.79 KiB) Viewed 407 times
User avatar
dale_coop
Posts: 3555
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: values for user constants

Post by dale_coop » Sun Jan 13, 2019 5:16 pm

Strange, it should work!
I tried... with 36 (not 33)... but it's the same idea.

Here's my test:

Image

Image

Image
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
User avatar
stevenshepherd
Posts: 236
Joined: Sun Feb 18, 2018 5:25 pm

Re: values for user constants

Post by stevenshepherd » Sun Jan 13, 2019 5:56 pm

Hmm, strange. Thanks for the sanity check though! Glad I had the right idea. I'll try playing with it again to make sure I wasn't doing anything weird.
Post Reply