GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

distance ran tracker

someone help me with a distance tracker for my endless runner game? thanks a bunch in advanced , i cant seem to get it right

Comments

  • Braydon_SFXBraydon_SFX Posts: 9,111Member, Sous Chef, PRO, Bowlboy Sidekick GameSalad Employee

    Create an integer game attribute called Distance.

    Create a rule: When game.GameOver is false,
    -Timer: every 0 seconds,
    --Change Attribute: game.Distance to game.Distance+1.
    

    Extremely simple once you think about it. Hope this helps.

  • YourFace710YourFace710 Posts: 13Member

    @Braydon_SFX‌ ok, now the part i was having trouble with is having numbers counting the distance on screen

  • SocksSocks London, UK.Posts: 12,822Member

    @YourFace710 said:
    Braydon_SFX‌ ok, now the part i was having trouble with is having numbers counting the distance on screen

    Is your actor always running or does he stop at any stage during the game ?

  • YourFace710YourFace710 Posts: 13Member

    @Socks the actor isnt always running he can stop at any time

  • SocksSocks London, UK.Posts: 12,822Member

    @YourFace710 said:
    Socks the actor isnt always running he can stop at any time

    I see, I was going to suggest using the internal clock, but that's no good if he stops.

    As for your question about @Braydon_SFX 's post . . .

    "the part i was having trouble with is having numbers counting the distance on screen"

    . . . just have a Display Text behaviour that displays game.Distance

  • YourFace710YourFace710 Posts: 13Member

    @Socks said:
    . . . just have a Display Text behavior that displays game.Distance

    @Socks displaying text doesn't seem to work. the text that pops up is "true" also , any suggestions for a actor that doesn't continuously run?

  • SocksSocks London, UK.Posts: 12,822Member

    @YourFace710 said:
    displaying text doesn't seem to work. the text that pops up is "true"

    If you use Braydon's code . . .

    When game.GameOver is false,

    -Timer: every 0 seconds,

    --Change Attribute: game.Distance to game.Distance+1.

    . . . and if like he says the attribute game.Distance is an integer attribute, and you select that attribute in the drop down menu for your text display it will display game.Distance . . . . it would only show 'true' is you had selected a boolean attribute.

    . . . . . . .

    @YourFace710 said:
    also , any suggestions for a actor that doesn't continuously run?

    Presumably the actor is moved by a button or key . . ? Let's imagine it's the right arrow key.

    When right arrow key is down

    -Timer: every 0 seconds,

    --Change Attribute: game.Distance to game.Distance+1.

  • YourFace710YourFace710 Posts: 13Member

    @Socks This almost works. But a problem still remains, holding down the right arrow will up game.Distance by 1 and just stop, continuous clicks are needed to add game.Distance up.

  • SocksSocks London, UK.Posts: 12,822Member
    edited January 2015

    @YourFace710 said:
    Socks This almost works. But a problem still remains, holding down the right arrow will up game.Distance by 1 and just stop

    Are you using these rules ?

    When right arrow key is down

    -Timer: every 0 seconds,

    --Change Attribute: game.Distance to game.Distance+1.

    Could you upload a screenshot of your rules ?

    . . . . . .

    You didn't respond to the issue about 'displaying text doesn't seem to work. the text that pops up is "true" Did that issue resolve itself ?

  • YourFace710YourFace710 Posts: 13Member

    @Socks i fixed the text display bug by changing the attribute to an integer , here are the rules http://gyazo.com/9fa48a4d95f84a12d2042b19bc381623

  • SocksSocks London, UK.Posts: 12,822Member
    edited January 2015

    @YourFace710 said:
    Socks i fixed the text display bug by changing the attribute to an integer

    Ok, that makes sense.

    Your change attribute behaviour has to go inside the timer.

    X.jpg 137.7K
  • YourFace710YourFace710 Posts: 13Member

    @Socks , your awesome I would give you a cookie , but I'm too busy developing thanks for the help! Ill let you know when my app is on the app-store / play store seeing that you have helped me alot already!

Sign In or Register to comment.