Bottom-top infinite scroller

Get help using Construct 2

Post » Mon Sep 03, 2012 10:16 pm

Hi, I'm new here!

I'm trying to make a running game (like Robot Unicorn Attack, Cannabalt etc.), but from bottom to top:
I have 2 BG pics:
*a forest
*a tree trunk

and the character on it.
The character shall move automatically upwards (bullet movement?), and the 2 BG pics shall repeat infinitely in the y direction.

I can't seem to get that done.
I searched the forum here, but nothing really nailed it - I'm not a native English speaker, so maybe I have misunderstood some things.
I have done the top down standard tutorial.

Problems:
1. I want the screen scrolled to my character - but not at the center, but at the bottom of the screen where I placed my character initially.
2. How do I get my BG pics to repeat in Y axis?

Maybe we can start just with this...

Bye and thanks in advance!
B
4
Posts: 12
Reputation: 374

Post » Mon Sep 03, 2012 10:49 pm

1. get rid of the scroll-to behavior, and make an event:
every tick:
--> scroll to X: player.X
--> scroll to Y: player.Y + somenumber

2. You will have problems with an infinite layout. For something like this, you should have the background moving down, and the player standing still.

As for how this is done, have a look at the FAQ, specifically the scrolling/camera section.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Tue Sep 04, 2012 7:36 pm

Okay, I got it!
The player is standing still now, and the background is scrolling via the method posted by Kyatric in this thread: http://www.scirra.com/forum/scrolling-tiled-background-c2_topic44823_page1.html .

However, I still have that ominous "gap" between my tiles that the author of that thread spoke of as well.
Casting the "dt" to an int didn't help either.

e.g.
[code]event => TiledBackground.X to TiledBackground.X - int(60*dt)[/code]

And the gap issue wasn't solved in that other thread. Does anybody has a hint? Here is my capx:

slurp.capx
B
4
Posts: 12
Reputation: 374

Post » Tue Sep 04, 2012 8:49 pm

Instead of setting y to 0, set it to 'self.y - self.Width * 2'.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,000

Post » Tue Sep 04, 2012 9:13 pm

Okay, that did it. Thank you very much!

...but why? In my example this would be
[code]self.y = 1600 - 800*2[/code]
which is... nearly... identical to 0 :p ! Why does that make a difference?
B
4
Posts: 12
Reputation: 374

Post » Tue Sep 04, 2012 10:14 pm

Setting y to 0 works if y is exactly 1600 when you change it. But if the background has gone a little bit past 1600 (which it can) then you get the gap.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,000

Post » Sat Sep 08, 2012 4:21 pm

Okay, I get it!
Thanks for alle the help! It works now and I'm about to implement more features, a local highscore and so on...!
B
4
Posts: 12
Reputation: 374


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, randomly, spcsmrf, Yahoo [Bot] and 27 guests