License from €75
DE EN FR ES IT CZ

Center player with vertical scrolling

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 10 years ago
    So in my game, the player can go up a fire escape, and to do this, I just made a tall background.  The problem is that the player is not centered on screen.  When trying to go back down, the player sorta gets stuck towards the bottom of the visible play-area, and you cant click lower.
    I set it up so you can scroll when your cursor is at the edge of the screen, but it's not a very pretty fix.
    Any way to have the "camera" stay on the player as he moves vertically?

    I used the script below for horizontal centering, but I'm afraid that if I try to alter it to make it vertical, I will mess it up... smile

    Any ideas?
    game.GameHorizontalScrollDistance = (game.WindowResolution.x / 2) -- 50% resolution width
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license. Forum readers get the Indie Bundle 15 % off with the code FORUM15: €84.15 instead of €99, valid until 31 Dec 2026.

    Get 15 % off Try it for free
  3. · 10 years ago
    Vertical would be same except...
    game.GameVerticalScrollDistance = (game.WindowResolution.y / 2)

  4. · 10 years ago
    Thaaaats what I thought.  Didn't want to mess with it myself...
    Thanks so much!

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?