Coding notes #1 Gamemaker Wall Collision For platformers

 //wall collision

if (place_meeting(x+hsp,y,oWall)){

while (!place_meeting(x+sign(hsp),y,oWall)){

x += sign(hsp);

}

hsp = 0;

//wall jumping code

if (jump) && (!place_meeting(x,y+2,oWall)){

vsp -= 6;

}

}

//hsp movement

x += hsp;


if (place_meeting(x,y+vsp,oWall)){

while (!place_meeting(x,y+sign(vsp),oWall)){

y += sign(vsp);

}

vsp = 0;

}


y += vsp;

Comments

Popular posts from this blog

Psychological manipulation #2 Big numbers

Power Creep

Deck Size matters