• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Having some trouble with moving platforms

So for the past few days I have been trying to get moving platforms to work in GameMaker Studio 2. Started by following Shaun Spalding's tutorial (1 way platforms and moving platforms). I also have some acceleration and deceleration of my character that might be causing my issue. Was hoping to get a second pair (or 3 or 4) of eyes on it. When my character lands on the platform they slowly accelerate off even though my push variable gets set to 0 after being applied to my movement variable. Maybe it is just an order thing, but I can't figure it out despite trying to google and draw out the issue. Any insight would be greatly appreciated.



Player accel/decel code
GML:
//What way walking
var move = key_left + key_right;

//Are we trying to move?
if (move != 0) {
    //Can you move
    if (canMove) {
        //Accelerate
        if (xMove != 4*move) {
            xMove += move*playerAccel;   
        }
        if (onGround) {
            //Animate player
            sprite_index = spr_pc_walking;
        }
    } else {
        xMove = 0;
    }
//Slow down
} else if (move == 0) {
    if (xMove > 0) {
        xMove -= playerDecel;   
    } else if (xMove < 0) {
        xMove += playerDecel;
    }
    if (canAttack) {
        //Animate player
        sprite_index = spr_pc_stand;   
    }
}
Player fix fraction movement

//Fraction Code
GML:
//Fraction Code
xMove += xMoveFrac + xPush;
xPush = 0;
yMove += yMoveFrac;
xMoveFrac = frac(xMove);
yMoveFrac = frac(yMove);
xMove -= xMoveFrac;
yMove -= yMoveFrac;
 
Top