# How are Tile Collision Slopes done in Game Maker Studio 2 / GML or in general?

I have been trying to get my slopes to function for almost a month now, doing nothing else with the project. Rewrote it 6-7 times in different collision styles, sometimes coming close to success while still being stuck with absolutely no help I could find during this month.

Here are the methods that I tried and what happened:

First I followed a video tutorial specific to game maker 2's tile collisions. It fills an array with how many pixels are filled on the y axis for every pixel on the x. Then it calculates how deep the player's (bounding box) bottom-center is in the slope tile and pushes him above the corresponding pixel count from the array.

Worked great for my floor slopes, didn't for my ceiling slopes. So I tried to reverse the way the pixels are counted and got a proper array, however fiddling with this system for 2 weeks alone, I still got stuck, presumably due to a math error.

If you are interested about this system, I basically posted everything there is to it on the yoyogames forums: Here

I definitely need ceiling slopes to work, since the game is a Metroidvania like game, where there might be a lot more vertical movement going on.

But then I figured, I could simplify this whole procedure, since my pixel art aesthetic currently uses one type of slope (where I potentially would like to keep the system to work with any slope that is a straight line for future additions) Currently my only slope is 2 tiles wide and 1 tile high.

I tried around with setting the player's y coordinate according to the linear function y = m*x + b I tested this by putting in y = -0.5 * current player position + the y coordinate of the slope tile in the room. However this function sets my player a fair bit above the slope, in the air. I know this is a lot to ask and maybe I'm totally stupid about this problem but I really tried HARD on this one, with my current knowledge and the one that is readily available I can't solve my issue.