Creating Sprite BitMasking

Hello, i made procedural world generation for my game and I need help with creating bitmasking

I am trying to make a 8 bitmasking following this tutorial also i created every needed aniamation for my “color” object: link

Here is my code:



Result:

I actually have no idea how to make it and hope you will help me

Project files (optional)

Project files: https://drive.google.com/file/d/1eUyaX_PkOnDYf_Bg7kvWnUWc7UnG7CLx/view?usp=sharing

Edit: IDKW, but in the formula I typed below the site removed my asterisks. It should be a * 1 + b * 2 etc but when I omit the space, it removes the *.

I can’t say i understand the code but the formula where it seems to be converting from binary to decimal doesn’t look right. I apologize if I’m making the wrong assumption.

Is it missing variables e and g?

If this is meant to be a binary conversion then the sequence would be a1 +b2 +c4 + d8 + e16 + f32 + g64 +h128 (this is just the formula, you would need to add the Variable() )

I looked at the link some more and I understand a little. I still think e and g are needed.

For 8-bit masking it seems like you need to convert the number before assigning the animation.

Under “Tile Order” is says

"Another problem you may notice is that the values calculated by the 8-bit bit masking procedure no longer correlate to the sequential order of the tiles in the sprite sheet. There are only 48 tiles, but our possible calculated values range from 0 to 255, so we can no longer use the calculated value as a direct reference when grabbing the appropriate sprite. What we need, therefore, is a data structure to contain the list of calculated values and their corresponding tile values. How you want to implement this is up to you, but remember that the order in which you check for surrounding tiles dictates the order in which your tiles should be placed in the sprite sheet. "

This is wrong:

You have 32 * 0, 16 * D and 16 * H

What I’ve always used is the following patter - if the letters go:

A B C
H _ D
G F E

then I use

A + B*2 + C*4 + D*8 + E*16 + F*32 + G*64 + H*128