Smooth scrolling / panning

  • #10, by SDMonoSunday, 07. September 2014, 18:27 10 years ago
    Would there be a way of changing the scrollspeed via LUA "game:setValue(VGameScrollSpeed, 200)" and increase it while the scrolling is going on?

    Forum Fan

    148 Posts


  • #11, by afrlmeSunday, 07. September 2014, 19:38 10 years ago
    The tween function is not affected by the speed value. It is affected by the delay value. Try changing the easing values & see what happens.

    Some of them start slow, speed up & then slow back down towards the end. For example: easeQuintInOut would slowly build up speed & then slowly decrease speed towards second half of the delay.

    Imperator

    7278 Posts

  • #12, by SDMonoMonday, 08. September 2014, 16:55 10 years ago
    In the end I am going to use something like this: "startObjectTween(game,VGameScrollPosition,game:getPoint(VGameScrollPosition),{x=180,y=0}, 2500, easeQuintOut)" in an action area and let the screen pan to the leave or the right depending on the character entering or leaving the action area. It's really smooth. It messed up some of the displayed text when starting a new game because it had stored the scroll information. I fix that problem by resetting the the ScrollPosition to x=0,y=0 executing a script At end of scene. grin

    Thanks Lee for the line of script!!!

    Forum Fan

    148 Posts

  • #13, by AkcayKaraazmakMonday, 08. September 2014, 17:42 10 years ago
    Hey Gordon,

    How we can also make the scene scroll with the mouse move mate? When character goes and also if character stays but when user moves the mouse to the edge of scene.

    I entered your code; startObjectTween(game,VGameScrollPosition,game:getPoint(VGameScrollPosition),{x=180,y=0}, 2500, easeQuintOut) in the action of " at begining of scene " action but nothing is happening when I move the mouse to the edges.

    Great Poster

    440 Posts

  • #14, by SDMonoMonday, 08. September 2014, 20:20 10 years ago
    Hmm... I am not using the option for scroll with the mouse in my game. But you are right... when I activate the option "Scroll scene if cursor is at the screen edge" it won't let me scroll.

    Forum Fan

    148 Posts

  • #15, by afrlmeTuesday, 09. September 2014, 02:57 10 years ago
    Simon gave me the scroll position start object tween code.

    If it's not scrolling then it could be a bug I suppose? I can't say I've bothered testing that function since 3.7.1.

    Imperator

    7278 Posts

  • #16, by SDMonoTuesday, 09. September 2014, 05:25 10 years ago
    Made a little example. Here is a download link so you can check it out: http://www.filedropper.com/panning_1

    Forum Fan

    148 Posts

  • #17, by SDMonoTuesday, 09. September 2014, 05:32 10 years ago
    Is there a code to stop the object tween? Maybe that would fix the mouse bug. It doesn't bother me because I am not using the mouse scroll but maybe someone else needs a fix.

    Forum Fan

    148 Posts

  • #18, by AkcayKaraazmakTuesday, 09. September 2014, 10:16 10 years ago
    Thats great Mate! works perfectly now I'll try to find a way to use it with mouse scroll grin

    Great Poster

    440 Posts

  • #19, by AkcayKaraazmakTuesday, 09. September 2014, 11:16 10 years ago
    Hey Gordon, mate your code has worked perfectly. I made a object in a scene without image and I used the logic that you used on action areas. And when you move the mouse it does the smooth panning. Only thing for me needs to be fixed is not let cursor to changed. Because I dont want the cursor to see it as an object.

    Thank you again mate!!!

    Great Poster

    440 Posts

  • #20, by ke4Tuesday, 09. September 2014, 11:26 10 years ago
    You can create a new cursor, which is same looking but doesn't have active image and change to this cursor on hover.

    Key Killer

    810 Posts