Distance Score Infinite Jumper

0 favourites
From the Asset Store
Create the right kind of drama with Film Scoring Tools sound library!
  • The title says it all, I'm simply looking for a way to keep track of the distance traveled by my infinite jumper player, and display it in the game. Thank you in advance!

  • Create a variable StartY and on start of layout set it to player.y

    Create a variable Score and every tick set it to round(abs(player.y-StartY))

  • Thank you, took me a while but I finally figured it out.

  • I have a new issue, now when the character is falling the distance decreases =/ how can I stop this from happening?

  • Add a condition

    system compare two values : round(abs(player.y-StartY))>Score

  • So for the first value I put        round(abs(Toby.y-StartY))

    and for the comparison I put        > Greater than

    then for the second value I put      Score

    But after I click done, Construct tells me 'Score' needs an expression after it.

    Any idea why it's saying that, if I did something wrong? Or if you know the expression that goes after Score. would be truly helpful.

    Thank you

  • Score should be a global variable you created as I said in my first reaction.

  • So I put the global variable StartY that you gave me in your first reaction after Score. and it didn't work it tells me Start is not an expression or instance variable in Score, then I put Score.Player.Y and it allows me to click done but the points are still decreasing as my player falls. Any help on elaborating?

  • I forgot the

    on start of layout - system set value StartY : Player.y

    but I hope you can understand this:

    <img src="https://dl.dropboxusercontent.com/u/48563442/distance.png" border="0" />

  • I'll try, the image you attached to your post is not working for me though.

  • The image should be working now.

    I'm not sure what you think

    System | round(abs(Toby.Y-StartY)) | > Greater than | Player.Y

    should do, but it is checking if the distance between startY and Toby.y is bigger than the player's Y-position.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, it didn't work, so I put.

    Group: SCORE

    -> System | On start of layout | Set StartY to Player.Y

       System | round(abs(Player.Y-StartY)) > Score | Set Score to round(abs(Player.y-StartY))

    But it's still not working.. sigh, sorry man I'm new to this whole Construct scene just trying to really understand as much as I possibly can.

  • I posted and deleted that I thought I would've had it down from what you showed me

  • So where is StartY?

    I tried it again it's not working for me here is how my event looks

    <img src="http://i61.tinypic.com/e6uc60.png" border="0" />

    I also tried using > Score

    Instead of > Toby.Y

  • Ok, could you please explain, what you think these events do, so I can try to understand why you made it this this way?

    What was wrong with the example I made?

    Just add a (new) event to my example.

    on start of layout - set StartY to toby.y

    add the action set text to Score to the event in my example and you should be ready.

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