CryptidProductions
Member
These are my physics functions
I have this weird bug I'm just now noticing where hitting a wall (ie: the side of a block) when the vspd isn't 0 can make her get stuck partially inside it and just freeze there with no ability to move
GML:
//this function gives an object gravity and sets a varible if they're in a state of falling.
//Each instance that uses it must set their own grav and vspd values at some point before it's called
function gravity_scp(){
//see if falling and declare if so
if vspd > -1 {
vdir = 1;
}
//apply gravity
if vspd < 5 {
vspd += grav;
}
//find ground and land on it, setting vsp to 0 once feet are planted
if place_meeting (x, y+vspd, Solid_Floor_Obj) {
while !place_meeting (x, y+sign(vdir), Solid_Floor_Obj) {
y += sign(vdir)
}
vspd = 0;
}
//apply vertical movement
y += vspd;
}
//finds wall and stops against it
//each object using this much have a directional value set
function wall_collisons_scp(){
//normal block
if place_meeting (x+4*hdir, y, Solid_Floor_Obj) {
while !place_meeting (x+sign(hdir), y, Solid_Floor_Obj) {
x += sign(hdir)
}
hspd = 0;
}
}
I have this weird bug I'm just now noticing where hitting a wall (ie: the side of a block) when the vspd isn't 0 can make her get stuck partially inside it and just freeze there with no ability to move