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

  • 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?

  • Do:

    System -> Every Tick

    System -> Set <YOUR GLOBAL> = <YOUR GLOBAL> + 1

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • 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

    very tick

    vInMotion=1 -> set YOURGLOBAL = YOURGLOBAL + 1

  • thanks, but again, that just registers time spent playing the game....I'm looking to register the movement of the tiled background

  • 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)

  • I think that's what I needed....thanks

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