How do I... measure distance on a scrollng background?

Get help using Construct 2

Post » Sun Mar 30, 2014 2:26 am

I have a scrolling tiled background setup like the one in the Flying template. I know how to make a text display a global variable....but how do I make it count up each time the tiled background passes by?
Phase 1: Collect Underpants.
Phase 2: ????
Phase 3: Profit!
B
16
S
5
G
4
Posts: 106
Reputation: 2,450

Post » Sun Mar 30, 2014 3:08 am

Do:
System -> Every Tick
System -> Set <YOUR GLOBAL> = <YOUR GLOBAL> + 1
Visit me at EgoAnt.com
B
51
S
7
G
7
Posts: 78
Reputation: 6,408

Post » Sun Mar 30, 2014 3:52 am

Thanks for the reply. I don't think I asked the right way....my problem is more about registering the travel of the tiled background. As it moves from one side of the screen to the other, I'd like a ticker to count up.

My version of the game doesn't automatically scroll from the start of the layout, as in the Flying template....in mine, you have to hit SPACE to set everything in motion. But when I do the "every tick" method, it starts counting as soon as the layout loads....which leads me to think it's actually registering the passage of time instead of distance. Am I wrong about that? If so, what do I need to do to resolve this? thanks again
Phase 1: Collect Underpants.
Phase 2: ????
Phase 3: Profit!
B
16
S
5
G
4
Posts: 106
Reputation: 2,450

Post » Sun Mar 30, 2014 11:57 am

Hi, if you just want to start the counter after space is pressed you could use another variable, say gvInMotion.

example:
> On space pressed -> set gvInMotion to 1

>Every tick
>gvInMotion=1 -> set YOURGLOBAL = YOURGLOBAL + 1
If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
35
S
13
G
7
Posts: 363
Reputation: 7,283

Post » Sun Mar 30, 2014 3:14 pm

thanks, but again, that just registers time spent playing the game....I'm looking to register the movement of the tiled background
Phase 1: Collect Underpants.
Phase 2: ????
Phase 3: Profit!
B
16
S
5
G
4
Posts: 106
Reputation: 2,450

Post » Sun Mar 30, 2014 9:10 pm

There is another way. If you are using the helicopter-style flying example there is also a property attached to the Bullet property of the tiles background. You could do something like this:

Text -> Set Text = round(TiledBackground.Bullet.DistanceTravelled)
Visit me at EgoAnt.com
B
51
S
7
G
7
Posts: 78
Reputation: 6,408

Post » Mon Mar 31, 2014 12:13 am

I think that's what I needed....thanks
Phase 1: Collect Underpants.
Phase 2: ????
Phase 3: Profit!
B
16
S
5
G
4
Posts: 106
Reputation: 2,450


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 32 guests