how to scroll a layer?

0 favourites
  • 6 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • I feel very stupid asking this, as it seems so basic, but cant find it in the manual and doing a tutorial search for "scrolling" or "layer scrolling" doesnt turn up any relevant results.

    In the quest to simulate swiping left and right to bring in layouts from the left and right, I created 3 layouts, one for the game, and one left and one right. I could not find a way to scroll the layouts left and right (or even swap them).

    So now Ive created one large layout, plasted in a big bagroud image, and added some objects.

    There is no "player" or similar, its a puzzle game.

    1) The first problem is the window outline (in the editor) is always in top left corner of the layer outline. How do you move the window area to the center of the layer (which is larger than the window)?

    2) How could I scroll the layer ralative to the window based on user input? I can move an image on the layout by changing its X & Y, but then none of my objects move - only the image You cant select a layer as an object to increment or decrment its X. I saw a system->layers->set scale etc, but there is no set X.

    3) assuming there is an easy answer to 2) above, how do I stop it scrolling off into blank area? Do I have to keep a copy of the amount they have scrolled, and compare it to the width of my image on my layer etc.

    4) I went through the examples with came with the app, and I can see one called "platform 7(parallax). It manages to scroll the layer under the window, but there are no actions to do this, only actions to move a player which I dont have. Space Blaster also does it vertically, but cant see where - its magic!

    Does this mean I need to create an invisble player/spacechip to scroll the layer? If so how do I go about this?

    If someone writes a user guide for construct 2, I would buy it immediatly.

  • FYI, I tried doing:

    System set scroll X to scrollx -10


    System set scroll X to scrollx +10

    based on input, but neither of these does anything (visible at least).

  • Think of it as scrolling the camera rather than scrolling the layer.

    System -> Scrolling ->

       Scroll to object

       Scroll to position

       Scroll to x

       Scroll to y

    To scroll to the middle of the layout:

    System: Scroll to (LayoutWidth/2, LayoutHeight/2)

    To scroll continuosly to the right:

    System: Set scroll X to scrollx + 1

    There's also the ScrollTo behavior that when applied to an object will make the camera follow it. That's what's used in the platform example.

    Space Blaster uses an invisible sprite called 'Scroller' and then does

    System: Scroll to (Player.X, Scroller.Y)
  • And you also have the examples from the "how do I FAQ" in the "Scrolling / Camera" section that are examples of how to do several type of scrollings/cameras.

  • OK, getting there slowly.

    1) create a layout 3x the width of the window.

    2) in "System->start of layout" do "System -> set scroll X to (half your layout width)

    3) on your event to scroll left/right, do: "System->Set scroll X to scrollx +/- 10

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Kyatric - you must be sick of me by how - sorry!

    A wiki we could contribute to would be an interesting Idea, kind of like your FAQ list would point to how to articles, rather than discussions. This could be the missing user guide with examples counterpart to the manual which is the refrence part.

    Have you not been tempted to write a user guide for dummies like me and sell it for �40 a pop? There is an oreilly book for Impact titled "HTML5 game development" which is only 100 pages, but seems to sell well (I read it anyway).

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