ScrollTo Issue

0 favourites
  • 4 posts
  • I would post up my CAPX, but I just can't as it's a completed game.

    Here is my issue. I have a Layout that is 1100,800 and window size is 960x640. On start of layout I am setting scrollto x to 550, and scrollto y to 400 so the window is centered on my layout.

    I cannot get it to work. I have checked and doubled checked every object to make sure they don't have a scrollTo behavior. I even opened up a compiled c2runtime.js file in notepad++ to make sure nothing had a scrollto behavior.

    This is an existing game that I just recently changed the layout and windows sizes on it. I tried the above on all 4 of the existing layouts (each with their own event sheet) and it just won't center.

    However, if I created a new layout in the project with a new event sheet it works fine.

    Could I be overlooking something on my existing layouts? I do this pretty much in all of my new projects (to allow for various screen sizes) and I have never had a problem until now, so I have to just be missing something.

    Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What happens when it "doesn't work"?

    I have occasionally come across mysterious problems that I can't recreate and never figure out why they happen on my large project. It is most likely something you're overlooking but we can't rule out the possibility of a bug.

    If I were to try and figure it out, I'd copypasta the project/capx (just so I don't instinctivly press CTRL+S by mistake lol), and open a layout where this bug occurs, and begin deleting things chunk by chunk, sprites and events, and when you realise your Scroll event works after deleting some stuff, you can CTRL+Z and delete less, and eventually pinpoint exactly whats going on. If you eventually get to a blank layout with no events and few sprites except the scrolling event, then yeah that's a bug lol.

    Hope this is a useful idea for you!

  • Thanks, what happens is it doesn't scroll to the point I am asking it to, in this case the center of the screen. The window just focuses on the upper left as if there is no scrollTo events.

    I've had weird stuff happen too and the only fix was the basically start from a fresh project. Might have to do that :).

  • Figured it out, on the non working ones the Parallax was set to 0,0

    I wonder if the version of C2 I was using when I first started this project defaulted the parallax to 0,0 and now it defaults to 100,100

    :)

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