Camera scrolling has suddenly changed in my game after 5.0.8 update

  • #1, by el_geeSunday, 18. November 2018, 16:27 5 years ago
    Hey guys,

    The camera movements of my game have now suddenly changed?
    It seems this has occurred due to some of the updates in 5.0.8. 

    It used to be constantly fixed on the current character, but now it kind of oddly goes in one direction before eventually catching up and centering on the character - until the character is moved again.

    First noticed this earlier today when I had to update windows platform before being able to make the build, where the eventual build had the 'new' camera settings.

    Thought it was because I had the 5.0.7 version, so I updated to 5.0.8, and now all versions and test runs are acting like this. 

    Game starts by executing this script:

    game.HorizontalScrollDistance = (game.WindowResolution.x / 2)
    game.VerticalScrollDistance = (game.WindowResolution.y / 2)

    anyone have any ideas what's happening or how to fix this? 


    Newbie

    45 Posts


  • #2, by SimonSSunday, 18. November 2018, 16:55 5 years ago
    game.HorizontalScrollDistance = (game.WindowResolution.x / 2)
    game.VerticalScrollDistance = (game.WindowResolution.y / 2)

    What is that supposed to do ? Try it without or reduce the border.

    The scrolling was changed because it tended to scroll back and forth ever repeating in some circumstances.

    You're probably better off scripting it via lua.

    Thread Captain

    1580 Posts

  • #3, by el_geeSunday, 18. November 2018, 17:05 5 years ago
    "game.HorizontalScrollDistance = (game.WindowResolution.x / 2)
    game.VerticalScrollDistance = (game.WindowResolution.y / 2)"

    was a script I found on the forum to center the camera on the active character, which has worked fine until now.

    I've tried setting it up as a definition script as well, but nothing changes.


    Newbie

    45 Posts

  • #4, by el_geeMonday, 19. November 2018, 08:20 5 years ago
    If anyone has anyone ideas on how to fix this I'd be really grateful. 
    My efforts aren't seeming to affect the new scroll issues.

    LINK   (current scrolling)

    The game was pretty much finished up to this point, and even has a release date with a magazine in two weeks here in Denmark. 
    Just a bit of a stressful surprise.

    Newbie

    45 Posts

  • #5, by SimonSMonday, 19. November 2018, 09:21 5 years ago
    2 options: 

    1) reduce the border (experiment a little with the - 100): 

    game.HorizontalScrollDistance = (game.WindowResolution.x / 2) - 100
    game.VerticalScrollDistance = (game.WindowResolution.y / 2) - 100

    2) a main loop handler:

    function scroll()
    local x,y = graphics.getScrollPosition()
    local gr = game.WindowResolution
    local t = game.CurrentCharacter.Position
    t.x = t.x - gr.x / 2
    t.y = t.y - gr.y / 2
    local r = game.CurrentScene.Sprite:getSize()
    t.x = math.max(0, math.min(t.x, r.x - gr.x))
    t.y = math.max(0, math.min(t.y, r.y - gr.y))
    x = x * 0.9 + t.x * 0.1
    y = y * 0.9 + t.y * 0.1
    graphics.setScrollPosition(x,y)
    end
    registerEventHandler("mainLoop","scroll")

    Thread Captain

    1580 Posts

  • #6, by el_geeMonday, 19. November 2018, 11:06 5 years ago
    Thanks for the input SimonS, greatly appreciated.
    I'll try it out later. 

    Newbie

    45 Posts

  • #7, by afrlmeMonday, 19. November 2018, 11:31 5 years ago
    If anyone has anyone ideas on how to fix this I'd be really grateful. 
    My efforts aren't seeming to affect the new scroll issues.

    LINK   (current scrolling)

    The game was pretty much finished up to this point, and even has a release date with a magazine in two weeks here in Denmark. 
    Just a bit of a stressful surprise.

    Got to be honest, the camera following the character around like it's on an elastic  band feels kind of nausea inducing with all of the motion.

    Imperator

    7278 Posts

  • #8, by el_geeMonday, 19. November 2018, 17:29 5 years ago
    It works!

    The sprites didn't used to be cropped down to a minimum, which used to work. 
    But now after cropping them + your script, it seems to be working fine.

    So relieved.

    There's a bit of funny business with some of my ''scroll scene to'' actions, but I expect I can fix that myself.

    Thank you so much for the support SimonS!!!!



    Newbie

    45 Posts

  • #9, by afrlmeMonday, 19. November 2018, 18:42 5 years ago
    strange, cropping them shouldn't have mattered as the position is based on the animation center you specify for each individual character animation.

    Imperator

    7278 Posts