I Wanna Be The Forums!

Please login or register.

Login with username, password and session length
Advanced search  

News:

Chat button has been eaten. Click here to join in the idling fun!

Author Topic: Making the player move with a platform  (Read 1091 times)

Cantavanda

  • Full Member
  • ***
  • Posts: 159
  • ~𝓕𝓵𝓸𝔀𝓮𝓻 𝓟𝓻𝓲𝓷𝓬𝓮~
    • View Profile
Making the player move with a platform
« on: June 24, 2015, 03:51:31 pm »

Hello, it basic platform movement in about any IWBTG engine, when your platform moves, the players moves with you
It goes with this code:
Code: [Select]

if (!place_free(x+hspeed,y)) {
    hspeed=-hspeed;
}
if (!place_free(x,y+vspeed+yspeed)) {
    if (vspeed!=0) {
        yspeed=-vspeed;
        vspeed=0;
    }
    else {
        vspeed=-yspeed;
        yspeed=0;
    }
}
y+=yspeed;
if (place_meeting(x,y-2,player)) {
    a=instance_place(x,y-2,player)
    a.y+=vspeed+yspeed;
   
    with (a) {
        if (place_free(x+other.hspeed,y)) x+=other.hspeed;
    }
}
if (place_meeting(x,y+17,player2)) {
    a=instance_place(x,y+17,player2)
    a.y+=vspeed+yspeed;
   
    with (a) {
        if (place_free(x+other.hspeed,y)) x+=other.hspeed;
    }
}
if (vspeed<0) {
    yspeed=vspeed;
    vspeed=0;
}
if (yspeed>0) {
    vspeed=yspeed;
    yspeed=0;
}

That is all to do with hspeed or vspeed
But what if I want to make the platform go in a path, if I try that, the player just stays where he is.
Is there any solution, to how I can make the player move with the flying platform, even if it is following a path?
Thanks!
Logged