how to scroll a layer?

Get help using Construct 2

Post » Wed Aug 22, 2012 11:37 pm

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.
nutmix2012-08-22 23:38:15
B
15
S
5
G
2
Posts: 357
Reputation: 3,691

Post » Thu Aug 23, 2012 12:09 am

FYI, I tried doing:
System set scroll X to scrollx -10
and
System set scroll X to scrollx +10

based on input, but neither of these does anything (visible at least).
B
15
S
5
G
2
Posts: 357
Reputation: 3,691

Post » Thu Aug 23, 2012 12:10 am

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:
[code]System: Scroll to (LayoutWidth/2, LayoutHeight/2)[/code]

To scroll continuosly to the right:
[code]System: Set scroll X to scrollx + 1[/code]

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
[code]System: Scroll to (Player.X, Scroller.Y)[/code]ramones2012-08-23 00:11:50
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Thu Aug 23, 2012 12:18 am

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.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Thu Aug 23, 2012 1:07 am

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

B
15
S
5
G
2
Posts: 357
Reputation: 3,691

Post » Thu Aug 23, 2012 1:20 am

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).
B
15
S
5
G
2
Posts: 357
Reputation: 3,691


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, mjj1990 and 9 guests