#Issue with vertical one way platforms

5 messages · Page 1 of 1 (latest)

amber geode
#

was wondering if anyone could help figure out with a problem of mine. For context I am opening up a project i did not work on for quite some time, and found that the last thing i was working on were moving vertical one way platforms. Here's the script for reference:

#
function jumpthrough2(argument0) {
    
    var obj = argument0;
    var falling = vsp >= 0;
    var platformUnder = instance_place(x, y + vsp, obj);

    if (falling && platformUnder != noone) {
        var notClipping = !place_meeting(x, y, platformUnder);
        if (notClipping) {
            while (!place_meeting(x, y + 1, platformUnder)) {
               y += sign(vsp);
            }
           vsp = obj.vsp;
        }
    }

    var onPlatform = collision_rectangle(bbox_left, bbox_bottom, bbox_right, bbox_bottom + 1, obj, false, false);
    if (onPlatform != noone) {
        var notInsidePlatform = !collision_rectangle(bbox_left, bbox_bottom - 1, bbox_right, bbox_bottom, onPlatform, false, false);  
        if (notInsidePlatform) {
           onground = true;  
           jumpbuffer = 6; 
            with obj{
                var playerAbove = instance_place(x, y-abs(vsp), oPengiPLYR);
                if(playerAbove != noone)
                {
                        playerAbove.y += vsp; onground = true;  
                }
            }
        }
    }
}
#

The problem is that it works except for platforms that "jump", basically one with gravity that go up and fall back down. Whenever these platforms land, my player object will fall through

amber geode
#

nvm got it working LOL