I've made a moving horizontal platforms code for a 2d platform game, and it works exactly how I want it to aside from one thing. Here's the code (placed in the wall object's step event):
repeat abs(horspeed) //horspeed is a variable that designates how fast the platform moves
{
var myhorspeed;
myhorspeed=horspeed;
x+=1*(horspeed/abs(horspeed))
if place_meeting(x,y-1,obj_basechar)
{
var me;
me=id;
with obj_basechar //obj_basechar is the parent object for the player character
if instance_place(x,y+1,me)
{
if !place_meeting(x+1*(myhorspeed/abs(myhorspeed)),y,obj_wall0) //obj_wall0 is, of course, the wall/floor object parent
x+=1*(myhorspeed/abs(myhorspeed));
}
}
}What I'd like to do is make it so this doesn't trigger if more than half of the player object is on a non-moving floor, but does trigger if more than half of the player is on a moving floor or no other floor at all. That way it doesn't push the player back if they, for example, stand on a cliff waiting for the platform to come pick them up. Right now when the platform reaches them, it pushes them back all the way onto the cliff because the moving floor is underneath them and it's still moving towards the cliff. Does that make sense?
Anyway, I would be most appreciative if somebody could give me some insight on how to modify this code.



Find content
Male
