I
Intergalakti
Guest
Hi,
I'm programming with GameMaker for about five years now. But all the time, when I was making a platformer, I had a problem: I don't know how to make a really good collision code. I currently am using the following code (simplified):
The problem with this code is that if I want to check for collision with the player in another object, I cant because the player stops just before he hits the wall. I tried to do make the objects that needed such a collision event non-solid and make themselves solid when the player hits them, but that works only once and isn't elegant at all. So I just wanted to ask the advanced programmers here how they do it. Thanks for your help!
Intergalakti
I'm programming with GameMaker for about five years now. But all the time, when I was making a platformer, I had a problem: I don't know how to make a really good collision code. I currently am using the following code (simplified):
Code:
if (!place_free(x+hspeed,y))
{
if (hspeed<=0){move_contact_solid(180,abs(hspeed));}
if (hspeed>0){move_contact_solid(0,abs(hspeed));}
hspeed=0;
}
if (!place_free(x,y+vspeed))
{
if (vspeed<=0){move_contact_solid(90,abs(vspeed));}
if (vspeed>0){move_contact_solid(270,abs(vspeed));djump=1}
vspeed=0;
}
if place_free(x+hspeed,y+vspeed) == false
hspeed=0
Intergalakti