![game maker studio 2 gml game maker studio 2 gml](https://ubunlog.com/wp-content/uploads/2021/09/preferencias-game-maker-2.png)
Y = -1 * (x - Tile_x) + TILE_SIZE + Tile_Y - 1 - sprite_bbox_bottom My bottom floor right slope made it so the formula was: Then populate the formula, which differs a bit from slope to slope.
Game maker studio 2 gml full#
Make a switch case for your slope detection (I made them not detectable for my other tile collision so tilemap_get_at_pixel returns 0 for air, 1 for full solid blocks and anything from 2-9 for the slopes) Get the slope tiles x and y coord = x/y & ~ TILE_SIZE_MINUS_ONE Turns out the answer was indeed calculating it with y = m*x + b 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. However this function sets my player a fair bit above the slope, in the air. I tested this by putting in y = -0.5 * current player position + the y coordinate of the slope tile in the room. I tried around with setting the player's y coordinate according to the linear function 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.īut 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)Ĭurrently my only slope is 2 tiles wide and 1 tile high. If you are interested about this system, I basically posted everything there is to it on the yoyogames forums: 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. Worked great for my floor slopes, didn't for my ceiling slopes. 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. It fills an array with how many pixels are filled on the y axis for every pixel on the x. Here are the methods that I tried and what happened:įirst I followed a video tutorial specific to game maker 2's tile collisions. 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.
![game maker studio 2 gml game maker studio 2 gml](https://i.ytimg.com/vi/BSoBhdoT2SE/maxresdefault.jpg)
I have been trying to get my slopes to function for almost a month now, doing nothing else with the project.