GameSalad

Howdy, Stranger!

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

How to make a timer stop when it hits a number . (help please)

I have this interpolating system and it starts at 20 and I don't want it to go past 5 seconds. It's making my objects come faster and faster which makes the game harder

So this is what i did to get speeding up
I made an integer attribute called "faster" & set it to 20.
So I said
1. Timer
2. every 10 seconds do
3. game.faster to game.faster-1

then I have my interpolate rule
1. Rule
2. when game.start = 1
3. interplate self position to -579 for "game.faster" seconds (which starts of at 20 seconds)

I want that timer to stop counting down once it hits , how can I achive this?

I have no clue honestly. :/

Comments

  • RabidParrotRabidParrot Formally RabidParrot. Posts: 956Member

    If Faster <= 5 constrain attribute to 5.

  • SocksSocks London, UK.Posts: 12,822Member
    edited October 2014

    If game.faster is > 5 then . .

    "every 10 seconds do 3. game.faster to game.faster-1"

  • SocksSocks London, UK.Posts: 12,822Member
    edited October 2014

    @Rabid Parrot said:
    If Faster <= 5 constrain attribute to 5.

    This will mean that the timer will continue to run - even when it's no longer needed - and as well as the timer you will have an additional constrain behaviour, that also constantly runs, you will basically have two fairly resource hungry behaviours constantly fighting each other to produce inactivity . . . . you'd be better off just sticking in a rule that defines when the timer stops, when the rule is met then the timer will no longer run.

  • RabidParrotRabidParrot Formally RabidParrot. Posts: 956Member
    edited October 2014

    @Socks well, I mean if you are trying to save memory. I guess.

  • SocksSocks London, UK.Posts: 12,822Member
    edited October 2014

    @Rabid Parrot said:
    Socks well, I mean if you are trying to save memory. I guess.

    I don't get the picture ?

    The idea was not to save memory, but to reduce unnecessary processes, which (accumulatively) are what lead to a less than smoothing running game. Like I say if you use something like 'If Faster <= 5 constrain attribute to 5' the timer will continue to run, and you are adding in a (also continuously running) constrain behaviour, it's probably better to just stop the timer.

    But your method works just fine too, and would probably be fine in a lot of situations, so try whatever method works for your game.

  • http_gamesaladhttp_gamesalad Posts: 1,340Member

    @Socks so how would I make that timer stop counting down once it hits 5?

  • SocksSocks London, UK.Posts: 12,822Member
    edited October 2014

    @http_gamesalad said:
    Socks so how would I make that timer stop counting down once it hits 5?

    Make sure it only operates when the value of the timer is above 5.

    If game.faster is > 5 then . .

    "every 10 seconds do 3. game.faster to game.faster-1"

  • http_gamesaladhttp_gamesalad Posts: 1,340Member

    @socks thanks bro :)

Sign In or Register to comment.