Space between incoming platforms issue (Jump & Run game)

Hello everyone,

I'm having trouble making my platforms appear correctly. If the largest platform appears, the next platform appears close, a relatively good distance, but if the smallest platform appears, then the next platform will be very far away. I would like to maintain a distance between platforms independently of their width.

Here is a video demonstration: https://www.dropbox.com/s/0xomp1r958wwm8q/spacebetweenplatforms.mov

What I am currently doing is that every 2 seconds a random platform will appear in a random position in Y at the right side of the screen, but a fixed position in X, which is also on the right side of the screen.
I'm currently using 250 in velocity to start with all the platforms, but independently of the speed, the space between platforms varies if the smallest platform appears, then the gap between the small platform and the next one will be the longest one.

Can anyone advice me how to make the gap between the platforms to be in a certain range independently of their width?

By the way, I don't know if you noticed but the platforms move a little lower when I step on them. The density of my hero is 0 and the density of all platforms is 9,999, how can I fix that too, though?

Thank you.

Answers

  • mrpacogpmrpacogp Member Posts: 400
    Use interpolate and uncheck movable platform.
    Use "max and min" for magnitude,(between platforms) its hard to understood how to use it, but you can take a great job with that.
  • davidsalomondavidsalomon Member Posts: 136
    Use interpolate and uncheck movable platform.
    Use "max and min" for magnitude,(between platforms) its hard to understood how to use it, but you can take a great job with that.
    Hey mrpacogp thank you for answering. Although I don't know about the interpolate that you are talking about. (I know what it is talking mathematically, but not in GS).
    I sent you a PM too.
  • domeniusdomenius Member Posts: 108
    You need to account for the width of the platform and adjust accordingly. for example, if you want to place platforms 100px apart, you could use the following equation to find the proper offset: offset = (plat1.size.width/2 + plat2.size.width/2). The result is added to 100 to provide the correct distance between each platform.
  • domeniusdomenius Member Posts: 108
    Also, don't use velocity for movement and it will be fine. Use move, move to, or interpolate instead.
Sign In or Register to comment.