values for user constants

stevenshepherd

New member
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 :)
 

dale_coop

Moderator
Staff member
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?
 

Mugi

Member
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
 

dale_coop

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

Here's my test:

2019-01-13-18-09-10-NES-MAKER-4-1-1-Version-0x158-Mon-Jeu-Aventure-MST.png


2019-01-13-18-13-09-Project-Settings.png


2019-01-13-18-13-37-FCEUX-2-2-3-game.png
 

stevenshepherd

New member
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.
 
Top Bottom