K
Kaijyuu
Guest
Hello, noob 856431684 here!
Im making my first game after space rocks in GMS2 and i've "learned" state machines, basically all my animations have a state machine. the problem is that when I press "C" my character crouches OK BUT when I press "C" again and there is wall ontop of my character, she stands up and gets stuck in the wall, I've tried place_meeting(x,y-1,obj_wall) countless times with no avail. No success. Also tried place_meeting(x,y-+[1,2,3,4,5,6,7,8,9,10,....22],obj_wall) also to now avail.
so -+ means negative and positive numers whats inside the [ ] are all numbers I tried.
here is my code to exit the state machine:
I think the problem might be that my collision box is not the same to my standing collision box, since the sprite I use for crouching is 50pixelslarger (x wise) than my standing sprite, but even if I set the collision bot to be exactly the same as the "normal state - stanting" the problem persists.
whenever I press C and a wall is ontop of me my character stands up and gets stuck. I want it to remain chouched until there is no wall ontop of my character and I press "C" again.
all my other collisions and animations are working ok but those have the same 100x100 sprite, my crouching sprite is the only sprite that is 150x100 but the hitbox is in the exact same spot (left = 41,top = 36, right = 58, bottom = 99)
I'll leave screenshots of my prite boxes.
Sorry cant upload the screenshots im getting an server error!
Im making my first game after space rocks in GMS2 and i've "learned" state machines, basically all my animations have a state machine. the problem is that when I press "C" my character crouches OK BUT when I press "C" again and there is wall ontop of my character, she stands up and gets stuck in the wall, I've tried place_meeting(x,y-1,obj_wall) countless times with no avail. No success. Also tried place_meeting(x,y-+[1,2,3,4,5,6,7,8,9,10,....22],obj_wall) also to now avail.
so -+ means negative and positive numers whats inside the [ ] are all numbers I tried.
here is my code to exit the state machine:
Code:
if (place_meeting(x,y-1,obj_wall) and key_crouch)
{
evelyn_state = evelyn_states.evelyn_squad_lowS;
}
if (!place_meeting(x,y-1,obj_wall) and key_crouch)
{
evelyn_state = evelyn_states.evelyn_normalS;
}
whenever I press C and a wall is ontop of me my character stands up and gets stuck. I want it to remain chouched until there is no wall ontop of my character and I press "C" again.
all my other collisions and animations are working ok but those have the same 100x100 sprite, my crouching sprite is the only sprite that is 150x100 but the hitbox is in the exact same spot (left = 41,top = 36, right = 58, bottom = 99)
I'll leave screenshots of my prite boxes.
Sorry cant upload the screenshots im getting an server error!
Last edited by a moderator: