Stop scroll: how many methods are there?

Get help using Construct 2

Post » Mon Dec 03, 2012 1:57 pm

Hi, I read this 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.
Posts: 24
Reputation: 638

Post » Tue Dec 04, 2012 1:32 am

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?

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


enable scrollto
trigger once

Posts: 928
Reputation: 13,762

Post » Tue Dec 04, 2012 9:37 am

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.
Posts: 24
Reputation: 638

Return to How do I....?

Who is online

Users browsing this forum: danispag, gmgllc, LaurenceBedford and 11 guests