0 Members and 3 Guests are viewing this topic.
{{r2/8*W+ // get tile row, multiply by width(r1/8)+ //get tile columnL1}*8+ // now we have the value of the tile you are in, then multiply by 8 because 8 bytes per sprite(r2^8)+ //get pixel row # with respect to the tile you are inStr1} //we add this to the pointer to the mask table, thus returning the exact byte of the sprite maske r1 // and now we check if the appropriate pixel is lit or not in the given rowReturnWhere r1 is your X position, r2 is your Y position, W is the width of your tilemap (in tiles), L1 is the location of your matrix data buffer, and Str1 is the start of your Mask Sprite table.
Wait, Builderboy might've messed something up...let me give my (i think) fixed code with explanationCode: [Select]{{r2/8*W+ // get tile row, multiply by width(r1/8)+ //get tile columnL1}*8+ // now we have the value of the tile you are in, then multiply by 8 because 8 bytes per sprite(r2^8)+ //get pixel row # with respect to the tile you are inStr1} //we add this to the pointer to the mask table, thus returning the exact byte of the sprite maske r1 // and now we check if the appropriate pixel is lit or not in the given rowReturnWhere r1 is your X position, r2 is your Y position, W is the width of your tilemap (in tiles), L1 is the location of your matrix data buffer, and Str1 is the start of your Mask Sprite table.