GameMaker [SOLVED]Basic Horizontal Collision Issues

Q

Quantum_Compooter

Guest
My player character is having problems with approaching my "wall" objects. As he gets closer to them he starts to blink and spazz out and then gets stuck inside the box and disappears.
Here is the code I am using for the collision
Code:
if(place_meeting(x+hz_mv,y,oWall)){
  while(!place_meeting(x+sign(hz_mv),y,oWall)){
      x = x + sign(hz_mv);
  }
  hz_mv = 0; 
}
I have vertical collisions set up using the exact same code just reverse for vertical. It seems to me that my player character can still move forward with the key pressed down when he should not be since I am setting hz_mv to 0. But like I said he flashes in and out when approaching the collision cube can get stuck and disappear in the cube but can walk back out and be fine if he gets away from it.
 
Q

Quantum_Compooter

Guest
is oWall flagged as "solid" by chance?
Also, is the order of code right? Collision should always be last.
I have tried having it solid and it did not make a difference. I wasn't sure if code order mattered in GML but glad I know now. I will try thanks.
 
Q

Quantum_Compooter

Guest
I have tried having it solid and it did not make a difference. I wasn't sure if code order mattered in GML but glad I know now. I will try thanks.
Wow that fixed it. What a ridiculous amount of hours gone. I usually work in C++ so I it really wasn't a thought in my mind. Thanks a ton friend.
 
Top