A Random Creator
Member
Hello everyone! I am making a platformer game and it is working really well so far, but I was trying to the player move with a platform that is under him (when it was also moving) and got it to work. The only problem is sometimes it works and sometimes it doesn't. I'm not sure why but most of the time when you land on a moving platform you move with it, but other times you will stay still even with the platform under you. Here is my code, hopefully you can find my error:
Player:
Moving Platform:
Player:
Code:
if(!place_meeting(x,y+1,objMovingObjects)) {PatformDir = 0} else {
hSpd = hSpd+PatformDir
}
if(!place_free(x+hSpd,y)) {
while(place_free(x+sign(hSpd),y)) {
x += sign(hSpd)
}
hSpd = 0
}
x += hSpd
Code:
hspeed = dir
if(place_meeting(x,y-1,objPlayer)) {PatformDir = dir}