R
Robzoid
Guest
I'm working on slopes and they're very sensitive to collision mask changes. I'm getting stuck in the slope when my player object turns around (i.e. when its image_xscale value goes from 1 to -1). I determined that the collision mask is shifting by 1 pixel when the sprite flips but it's not apparent why since the sprite origin is perfectly centered.
This is the sprite. For testing purposes, this is the only sprite I'm using in gameplay. I made sure to make the image width an odd number (41) so that the origin can be precisely in the middle (20). The origin (20) is 20 pixels from the left bounding box (0) and 20 pixels from the right bounding box (40). It's square in the middle.
I also commented out all my code in my step event except for the following:
If I press enter, the image_xscale flips from 1 to -1 and vice versa. The show_debug_messages tell me the distance from the right edge of the collision mask to x and the distance from the left edge of the collision mask to x.
See the output of 20, -20 in the pic below. When he's facing right (i.e. image_xscale = 1), everything is as it should be. I would expect the output to remain the same when the image_xscale value flips to -1 but that's not what happens unfortunately.
When I press Enter to flip, the output has switched to -21 and 19. This is why I'm getting stuck in the slope when I turn around.
The collision mask needs to have the same orientation to the origin when the sprite flips. Am I missing something or does image_xscale not work right?
This is the sprite. For testing purposes, this is the only sprite I'm using in gameplay. I made sure to make the image width an odd number (41) so that the origin can be precisely in the middle (20). The origin (20) is 20 pixels from the left bounding box (0) and 20 pixels from the right bounding box (40). It's square in the middle.
I also commented out all my code in my step event except for the following:
If I press enter, the image_xscale flips from 1 to -1 and vice versa. The show_debug_messages tell me the distance from the right edge of the collision mask to x and the distance from the left edge of the collision mask to x.
See the output of 20, -20 in the pic below. When he's facing right (i.e. image_xscale = 1), everything is as it should be. I would expect the output to remain the same when the image_xscale value flips to -1 but that's not what happens unfortunately.
When I press Enter to flip, the output has switched to -21 and 19. This is why I'm getting stuck in the slope when I turn around.
The collision mask needs to have the same orientation to the origin when the sprite flips. Am I missing something or does image_xscale not work right?