How do I add custom scrolling without ScrollTo behavior ?

0 favourites
  • 7 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • A bit of background: I am trying to create a retro side-scrolling platformer. For this I am using a Platform behavior on my player character, and enabled Integer coordinates in the view properties. Platform max speed is set to 80. Acceleration & deceleration are set to huge values like 1000 to get instantaneous speed changes. If I also add ScrollTo behavior to the player everything works fine.

    Now I want to do some fancy custom scrolling and that's where things are breaking. I removed the stock ScrollTo behavior and added a very simple event to the bottom of the sheet:

    Every tick: Scroll To X= Player.X

    This almost works except scrolling stutters by 1 pixel. I see the player move past the center by 1 pixel and then he snaps back to the center one frame later. My theory is that the Platform behavior updates the Player.X after my events are run.

    Can anyone confirm that is the case? If so, what are some workarounds to do custom scrolling without relying on ScrollTo ?

  • Use the 'magicam' addon. It's the best solution for whatever cam thing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could always write your own scrolling logic, which provides more control but of course is a huge pain in the neck and extremely time consuming...

    In a platform example where there is only X movement, you only need one variable (generally I just call it scrollspeed). You need to have events updating on every tick that move objects based on scrollspeed. When the player presses left or right, instead of moving them, you set scrollspeed to -10 or 10, for example. You can also add extra events in the ticks to gradually ramp up and slow down scrollspeed for smoother transitions.

    Needless to say this gets a little tricky, but it's how it's done outside of programs like Construct 2. At least, that's how I do it

  • I usually have a 'camera' object with Scroll To. If I need to focus somewhere, I just move this object.

  • Thank you, Zathan. I am looking at Magicam. My question though was more about using built-in functionality.

    siks I think this would run into the same bug/limitation that I am talking about. Let's say you want to have the camera 40 pixels in front of the player. If you add an event "every tick: camera.x = player.x" this will exhibit stutter for integer views.

    If the camera and player are linked via a Pin it works, however.

    EDITED: Never mind. I must have had a stray event somewhere. I recreated the event sheet and now it's behaving as expected.

  • I usually have a 'camera' object with Scroll To. If I need to focus somewhere, I just move this object.

    This is awesome coupled with MoveTo

  • codah Pretty much, yeah!

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