on-internet
← Community

My Game Maker Y collision code's while loop is infinite and I can't tell why it's not stopping

Stack Overflow ·

For whatever reason, the while loop runs, and despite the pixelCheck variable being assigned a non 0 value, the player's Y-coordinate does not change and the game freezes. When the player starts above the ground, it falls until the if placemeeting statement is met and then the while starts. //Y movement //Gravity ySpd += grav; //Jump if jumpKeyPressed && place_meeting(x, y + 1, obj_Wall){ ySpd = jSpd; } //Y collision if place_meeting(x, y + ySpd, obj_Wall){ var _subPixel = 0.5; var _pixelCheck = _subPixel * sign(ySpd); while !place_meeting(x, y + _pixelCheck, obj_Wall){ y += _pixelCheck; } ySp

Comments

Sign in or sign up to comment and upvote.

No comments yet.