Stop scroll: how many methods are there?

0 favourites
  • 3 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hi, I read this scirra.com/forum/solved-manage-scroll-behavior-metal-slug-like_topic45395.html and found Kyatric's ingenious method for stopping the scrolling, similar to how games like Metal Slug do it. Currently I'm using the ScrollTo method at every tick (event, not the behavior applied to player) on a test project, but the example got me wondering - how many ways are there of stopping the scrolling and locking it to a specific area on a layout? I'm asking because I'm really curious and I'd like to keep the code as clean as possible.

  • I haven't tried this myself at all yet, but couldn't you disable the scrollto behavior anytime the player's position is less than half of the layout width?

    then it will only pickup each time they cross the mid point of the screen?

    eg:

    system every tick

    player.x <= layout.width/2 -> disable scrollto

    else

    enable scrollto

    trigger once

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To be honest, I'm not sure how I can disable the ScrollTo behavior once it's made active (only reference to the behavior on the event sheet is the Shake action), though I know how to deactivate scrolling if ScrollTo is placed on an invisible "camera" pinned to the player (though in this case I merely destroy the cam).

    That's what I did on my current project, actually. Once the player's X coordinate is equal or bigger than <value>, I destroyed the camera and placed a solid object at the edge of the screen so the player cannot scroll out of the boundary. The only unforeseen problem was that I also have another condition, wherein the player moves -100 pixels if hit by an enemy, and now the player can go through that barrier if hit by the single enemy roaming the smaller area.

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