F
FrontalArrow302
Guest
OK so im like a few weeks into developing n learning how to code....somewhat.....i im doing good so far but now im stuck on the collisions for a moving platform i decide to add in. i was watching GameMaker Casts video on moving platforms and i got as far as making the platform move left to right....but when i comes time to add in the collision code.... the platform just freezes and the player still falls through....i tried tweaking the code slightly( kinda sorta don't know what i did lol) and the platform just vibrates vigorously and the player slowly falls thorugh like he's standing on quicksand. Any ideas on what i should do....something im not doing? Thank you!
This is the create event for the Platform
randomize();
direction = choose(-1,1);
hsp = 1;
vsp = 0;
grv = 0.1;
walksp = 2.5;
The beginStep event
x += hsp * direction;
if(x <= position_from || x >= position_to) {
direction *= -1;
}
AND THIS IS THE COLLSION CODE FOR THE PLAYER WHICH HE COPIED INTO THE PLATFORM STEP EVENT AND GOT HIS COLLISIONS BUT THAT ISNT HAPPENING FOR ME
//Horizontal Collision
if (place_meeting(x+hsp,y,wall1))
{
while (!place_meeting(x+sign(hsp),y,wall1))
{
x = x + sign(hsp);
}
hsp = 0;
}
x = x + hsp;
//Vertical Collision
if (place_meeting(x,y+vsp,wall1))
{
while (!place_meeting(x,y+sign(vsp) ,wall1))
{
y = y + sign(vsp);
}
vsp = 0;
}
y = y + vsp;
This is the create event for the Platform
randomize();
direction = choose(-1,1);
hsp = 1;
vsp = 0;
grv = 0.1;
walksp = 2.5;
The beginStep event
x += hsp * direction;
if(x <= position_from || x >= position_to) {
direction *= -1;
}
AND THIS IS THE COLLSION CODE FOR THE PLAYER WHICH HE COPIED INTO THE PLATFORM STEP EVENT AND GOT HIS COLLISIONS BUT THAT ISNT HAPPENING FOR ME
//Horizontal Collision
if (place_meeting(x+hsp,y,wall1))
{
while (!place_meeting(x+sign(hsp),y,wall1))
{
x = x + sign(hsp);
}
hsp = 0;
}
x = x + hsp;
//Vertical Collision
if (place_meeting(x,y+vsp,wall1))
{
while (!place_meeting(x,y+sign(vsp) ,wall1))
{
y = y + sign(vsp);
}
vsp = 0;
}
y = y + vsp;