How do I scrolling only when player jump ?

  • hello guys

    i would like to scroll to y of a player but only when it's jumping

    i use platform plugin and scroll to y when it is jumping

    but i have some glitch when player jump at the second time

    any trick ?

    thanks for help

    here is my capx https://ufile.io/kjs45

  • Hopefully this helps:

    https://www.dropbox.com/s/0meqzkt21ebbf ... .capx?dl=0

    What's going on in the original capx is that the y scroll occurs on the jump command, so the payer's y value is actually lower - or at least different - than the last y scroll value, which leads to a sizable jump in where the "camera" is looking. In my example, I use a value that only updates when the player's y value is less than itself for the scroll. I also could have probably done something like:

    If player.y is less than scroll.y -> set scroll y to player.y

    ...but this only just occurred to me haha.

  • Hopefully this helps:

    https://www.dropbox.com/s/0meqzkt21ebbf ... .capx?dl=0

    What's going on in the original capx is that the y scroll occurs on the jump command, so the payer's y value is actually lower - or at least different - than the last y scroll value, which leads to a sizable jump in where the "camera" is looking. In my example, I use a value that only updates when the player's y value is less than itself for the scroll. I also could have probably done something like:

    If player.y is less than scroll.y -> set scroll y to player.y

    ...but this only just occurred to me haha.

    Is this something that's easy to reapply to an X scroll instead of Y scroll? There are some older videogames that would let you walk to the right but not back to the left (Contra, Adventure Island on NES) and I've been wondering how to accomplish this setting of not letting the player go backwards.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sure thing:

    https://www.dropbox.com/s/ei1jwouuq5nlr ... .capx?dl=0

    If you don't want to be able to walk left at all simply remove that action from the movement group.

  • Sure thing:

    https://www.dropbox.com/s/ei1jwouuq5nlr ... .capx?dl=0

    If you don't want to be able to walk left at all simply remove that action from the movement group.

    It works very much like the older games. Thanks a lot.

  • Hopefully this helps:

    https://www.dropbox.com/s/0meqzkt21ebbf ... .capx?dl=0

    What's going on in the original capx is that the y scroll occurs on the jump command, so the payer's y value is actually lower - or at least different - than the last y scroll value, which leads to a sizable jump in where the "camera" is looking. In my example, I use a value that only updates when the player's y value is less than itself for the scroll. I also could have probably done something like:

    If player.y is less than scroll.y -> set scroll y to player.y

    ...but this only just occurred to me haha.

    that work

    thanks dude

  • My pleasure, you two. Best of luck with your projects!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)