Scroll scene by dragging

  • #1, by dramaminiFriday, 08. May 2015, 19:51 5 years ago
    Hi guys!!

    1. I have a big map as background image in a scene. Is it possible to scroll scene at any direction by dragging the map (using mouse or by hand on android version)?

    2. Is it possible to start a scene at a specific given position (for example in the middle of a big map) whithout the scroll effect at the beggining?

    Newbie

    44 Posts


  • #2, by afrlmeFriday, 08. May 2015, 20:47 5 years ago
    1. There's a checkbox option in each scene' properties tab: scroll scene if the cursor is at screen edge. If you tick that then the screen will scroll whenever the mouse enters the scroll borders at the edge of the current viewport.

    2. Sure, but you have to disable character centering. You will have to re-enable character centering when you want to make the camera automatically follow the character again.

    a. scene > center scene on character permanently > select character (tick clear centering checkbox)

    b. now you can define a scroll position without it scrolling by creating an execute a script action part containing...
    game.ScrollPosition = {x = 0, y = 0} -- replace 0, 0 with coordinates you want to set scroll position to.
    1
    2


    To re-enable camera follow character, you just have to follow step A, but leave the clear centering checkbox unchecked.

    Imperator

    6809 Posts

  • #3, by dramaminiFriday, 08. May 2015, 21:20 5 years ago
    1. Yes, I know, but I was wondering if there is a way while pressing the mouse button to drag the whole scene at mouse direction...

    2. Thanks! I'll try it!

    Newbie

    44 Posts

  • #4, by afrlmeFriday, 08. May 2015, 23:52 5 years ago
    Hmm I suppose it would be possible. I suppose you could store initial value of mouse cursor & scene scroll position into variables, then create a loop & have it offset position by distance mouse has moved towards or away from mouse depending on whether you want to inverse axis etc.

    Will have to think about it. My head's a bit bleh, at the minute.

    Imperator

    6809 Posts

Write post