don't click here

Question Regarding Tiles, Height Masks and Angles

Quartzviel

Press Start Screen
Dec 12, 2020
4
2
8
24
I've recently been using the Sonic Physics Guide to determine how tile-based collisions should be handled in my project. So far, I have a tile sensor and when a tile is found, its alpha channel is scanned. This is to form a height mask of the tile, and then I set Sonic's Y-pos to the Y-pos of the tile + its height offset at the X-pos of the sensor.

What I want to know now (and it is unfortunate that the SPG doesn't mention this) is how is the (surface) angle of a given tile supposed to be calculated and are there better alternatives? Of course, I do know that this will involve using the A-tan2 function, but alas, I do want to make sure that I do this properly.
 

SeanMorris

Green Hill Zone
Mar 8, 2021
15
9
23
33
The heightmasks also have angle data associated with them. If you're using alpha to store solidity you can use color to store angle.