Legacy GM Help with squash and stretch collisions?

E

Evilperson

Guest
I'm making a platformer and the player character is a black rectangle.
For game feel purposes, I made the character get taller and thinner when it jumps.
A problem is that if I jump right next to a wall the player character gets thinner, and when the jump ends, it restores its original dimensions and gets partially stuck in the wall.

I tried solving this problem (marked as yellow text):

//Squash and stretch
if vspd < 0 {
if image_xscale > 0.8 {
image_xscale -= .05
}
if image_yscale < 1.2 {
image_yscale += .05
}
}else{

if image_xscale < 1 {
image_xscale += .1
if place_meeting(x-1,y,obj_solid){
x+=3
}
if place_meeting(x+1,y,obj_solid){
x-=3

}
}
if image_yscale > 1 {
image_yscale -= .1
}
}

This prevented the bug when hitting a wall to the left, but not to the right.
Also, when the player jumps next to a wall, and not into it, they move away slightly.
Please help :pickle:
 
I

InkSho

Guest
what you can do is make a sprite for the mask so that the collision is the same at all times even if the sprite is warping
 
T

TDSrock

Guest
Make a collision mask that is consistent regardless of what happens to the sprite. issue resolved.
 
E

Evilperson

Guest
Already tried that, it seems that the mask is also affected when using image_xscale and image_yscale.
 
I

InkSho

Guest
what you can do is enable physics and set the mask there, it wont change no matter what if physics are enabled
 
Top