H
Hadin
Guest
I have a basic platformer project that I'm using to learn GML. Most of it is based off online tutorials. This isn't anything except tinkering and I needed to start somewhere with no coding experience prior to using Game Maker Studio 2.
I've been having an issue where if my player walks off a ledge and turns around immediately, they'll get stuck in the corner of the wall object. It is using the basic object oriented collision you find all over the internet. So I assume it's happening because I flip the xscale and when it does it overlaps inside the wall. I've since made a workaround but I'm wondering if anyone has insight into a better solution as I assume what I'm using now is crude:
I eventually plan to switch to tile collision as from my understanding it's better for simply not having a ton of objects in each room just to handle collision but for now it is what it is. Need to make art assets as is so figured this will be enough for learning other aspects of programming.
//EDIT:
I should add that I do have the sprites set up so that their collision masks are the same size for each one. The origin is off by 1 pixel since it's width is 8 pixels. I did redo the sprites so it's origin is literally centered but was still having the same issues so since reverted back to the original sprites as they looked better to me than the slightly wider version.
I've been having an issue where if my player walks off a ledge and turns around immediately, they'll get stuck in the corner of the wall object. It is using the basic object oriented collision you find all over the internet. So I assume it's happening because I flip the xscale and when it does it overlaps inside the wall. I've since made a workaround but I'm wondering if anyone has insight into a better solution as I assume what I'm using now is crude:
Code:
//Step Event, Before Animations:
if (hspd != 0)
{
if (left_held && image_xscale != -1)
{
x += 2;
image_xscale = -1;
}
else
{
if (right_held && image_xscale != 1)
{
x -= 2;
image_xscale = 1;
}
}
}
//EDIT:
I should add that I do have the sprites set up so that their collision masks are the same size for each one. The origin is off by 1 pixel since it's width is 8 pixels. I did redo the sprites so it's origin is literally centered but was still having the same issues so since reverted back to the original sprites as they looked better to me than the slightly wider version.
Last edited by a moderator: