Scroll To - Help!

1 favourites
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hello,

    I've been working on a game that required custom movement (not sure if this is relevant or not), grid style with smooth sprite animation. All that part works fine, but upon adding the Scroll To behaviour to the Hero Sprite, it doesn't seem to function properly. As my character walks off, the Scroll To function slowly follows the direction the keys are pushed but stops when the keys are released. It seems to mimic the Sprite movement, but at a slower pace allowing the Hero to vanish off the edge of the screen.

    Since Scroll To doesn't have much in the way of properties to fiddle with, I'm curious how to get it to stay centered on the Hero. Any help would be wonderful.

  • AlexandrTheGreat - did you create an invisible sprite with ScrollTo behavior and pin it to your Hero sprite?

  • I did not. I was just using the Sprite itself, without the invisible portion. Would creating the invisible sprite and Pin fix the issue?

  • I have a similiar problem with my flappy bird clone... ScrollTo is centered to the screen and there's no parameter to change it. I don't want my bird stay in the center of the screen, I want it scrolls when the bird is between the left side and middle of the screen.

    I tried Pin but the behaviour when it jumps is strange. Why not add a simple offset in the parameter panel to modify scrollTo?

    Edit: It's ok now, don't need to pin something, I just use an invisible sprite which has a scroll behaviour

  • : I added the invisible sprite as recommended, and changed around the events. However, the Scroll To behaviour is still scrolling at a slower rate than movement.

  • you mean like simple screen scrolling

  • Lordshiva1948

    I've attached what is currently happening. I've made the "invisible sprite" visible and blue, but translucent to monitor how it's interacting with the animation.

    Most of the events at this point are related to the Custom Grid Movement. It's a 64x64 grid, yet the Scroll To feature is only seems to be moving at 32 pixels.

    Scirra: I really wish you'd add a Grid Movement option.

  • Soon as I have time I will sort it out for you

  • Thanks a ton. Any help is greatly appreciated.

  • AlexandrTheGreat - as best practice, I think you want to give all the movement behaviors to invisible sprite, and pin the Hero sprite to that. But regardless, I tested your CAPX and see what you mean. The scrollx and scrolly are going by 32 and your Hero sprite by 64. I wonder if it has something do with your sprite's origin?

  • I have made CAPX my way how to scroll player with blue invisible player just see how it's done and then do it the way you want using same principal

  • : Thanks for the tip! Can you explain why it works better? It would help me understand the reason, but if it's just one of those "it just works better" that's fine too.

    : That works fine for me. Great work! I don't suppose you happen to know of a way to turn 8-Direction Movement into Grid style? It's so much simpler than the custom movement events. If not, I'll fiddle around with it later.

  • AlexandrTheGreat - I read that advice here in one of Ashley's tutorials: https://www.scirra.com/tutorials/253/how-to-make-a-platform-game/page-4

    If you haven't read that one yet, give it a look over.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the tutorial link. It makes a lot of sense, so I shall add it into my good habits. It detects the collision much better.

    After fiddling with the program a bit, I noticed a peculiar phenomenon. The Scroll To only seems to work if Unbound Scrolling is Yes. If set to No, it doesn't scroll at all. I'm also wondering if it has something to do with the Custom Movement. Perhaps the Scroll To behaviour is set at 32, but since mine is moving at 64, it's not playing nicely.

    Edit: I tried setting the Actions; Scroll to Object, and Scroll to X/Y hoping the same functions to make the grid movement work would work on the Scrolling too. No luck. It also doesn't matter whether the Scroll To behaviour is added to the invisible player sprite, or the animation: it behaves the same with the slow scrolling.

  • Your problem was that you had the scrollTo behavior on your menu as well, so the scroll was set between the two position.

    I did a few modification on your project:

    • moved the movement logic into the blue collision box
    • make the hero sprite slavishly follow the blue collision box (using Pin)
    • moved the scrollTo behavior to the blue collision box instead of the hero sprite. This way you don't have "hero moves -> pin position the blue box -> scroll to blue box" kind of potentially laggy interaction. Now it's more like "blue box move -> scroll to blue box + pin position the hero sprite" kind of flow.
    • few personnal tweaks on the layout properties because I'm maniac.

    scrollToConflict.capx

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