Having trouble with wall collisions
I'm working on this game right now (with GameMaker Studio 2) and I'm currently coding walls and when I tried making horizontal collision, it worked fine, but when I made floor collision I would get stuck in the walls and floor
here's the code:
//input
keyRight = keyboard_check(ord("D"));
keyLeft = keyboard_check(ord("A"));
keyUp = keyboard_check(ord("W"));
keyDown = keyboard_check(ord("S"));
// direction
var move2 = (keyDown - keyUp) * vspd;
var move = (keyRight - keyLeft) * hspd;
//collision stuff idk
if place_meeting ( x + move, y ,obj_wall)
move2= 0;
if place_meeting ( x + move2, y ,obj_wall)
move= 0;
// comiit
x += move
y += move2
If someone could tell me what I'm doing wrong and how to do it right please tell me I would appreciate it thanks in advance.
Comments
Post a Comment