Okay, save a backup version of your game, and I'll see if I can walk you through it.
In the
step event for all objects that have
obj_moveable as a parent, delete this line:
/* PLAYER PHYSICS */
event_inherited();
It is no longer needed, because the physics object's events are going to be moved to the Begin-Step and End-Step events, where they will automatically be inherited. Only if the object is already using the Being/End-Step events will you have to add the
event_inherited() line to that event's code to make sure that it's performing the code of its parent.
Next, go into
obj_moveable. In its
creation event, initialize the following variables:
h_counter = 0;
v_counter = 0;
on_ground = 0;
I don't know if you changed
obj_moveable at all, but now we are going to break it's
step event into the begin-step event and end-step event. So create those events, and in the begin-step, put the following:
on_ground = checkBelow();
And your end-step event will now be this:
var h, v, collide, slope;
//Add to the counters, then get the h and v (pixels to move this step) from them.
h_counter += hspd;
v_counter += vspd;
h = round( h_counter );
v = round( v_counter );
h_counter -= h;
v_counter -= v;
/* This loop will move the object based on hspd. The object will never
actually collide with a floor object, because this loop (and the next one for vspd)
will always position it right next to them without overlapping. If the
object collides with a wall, it will call one of two events:
User Event 0 - if the collision is horizontal
User Event 1 - if the collision is vertical */
collide = false;
slope = false;
repeat (abs(h)) {
if (place_meeting( x+sign(h), y, obj_floor )) {
if (!place_meeting( x+sign(h), y-1, obj_floor )) {
//Running up slopes
y -= 1;
x += sign(h);
slope = true;
} else {
//Hit a wall
collide = true;
break;
}
} else {
if (on_ground) {
if (!place_meeting( x+sign(h), y+1, obj_floor ) && place_meeting( x+sign(h), y+2, obj_floor )) {
//Running down slopes
y += 1;
}
}
x += sign(h);
}
}
if (collide)
event_perform( ev_other, ev_user0 );
if (slope)
hspd = approach( hspd, 0, S_SLOPE_SLOW );
collide = false;
repeat (abs(v)) {
if (vspd <= 0) {
//Going upward you don't have to worry about jumpthru platforms
if (place_meeting( x, y+sign(v), obj_floor )) {
collide = true;
break;
} else
y += sign(v);
} else if (checkBelow()) {
collide = true;
break;
} else
y += sign(v);
}
if (collide)
event_perform( ev_other, ev_user1 );
Make sure you scroll down to get it all. You'll notice a large comment in there that explains how the counters work.
Now we have to do is go into all moveable objects'
step event and rename all instances of the variable
pm_d to
on_ground. If you go into your code editor, you'll see this button at the top:
Click on that, and you can automatically replace all "pm_d" in the code with "on_ground".
Also, this line must be added to the top of all moveable object's creation events:
event_inherited();
And the following lines deleted from it:
pm_d = false; //Whether the player is currently standing on solid ground
hspd = 0; //Player's horizontal speed
vspd = 0; //Player's vertical speed
Because those variable initializations are now handled by
obj_moveable, and will be created when
event_inherited() is called. Also,
pm_d no longer exists.
And that should be it. What this does is makes so you can set your moveable objects with a
hspd or
vspd that is less than 1, and they will move at that rate. So if your object's speed is
.5, it will move 1 pixel every two steps (before, it would have just rounded this to 1 and moved 1 pixel ever step, and anything lower would have rounded to 0 and not moved at all).
Hopefully that all works for you. If this fails, feel free to PM me your GMK to me and I'll fix it up for you.