GameSalad

Howdy, Stranger!

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

Timers

Hey everyone, just trying to work out a timer for my game..
So i have got the countdown timer working fine (thanks to t-shirt booths video tutorial)
But I'm have trouble adding extra time when my character picks up bonus time.

Heres what i have so far:
2 game att: startTime and myTimer
In main character:
Change att: game.startTime to: game.Time
New Rule:
when att. game.myTimer > 0
constrain: game.myTimer to 60-(game.Time-game.startTime)

When timer gets lower I have added a pickup for the character but can't get it to add the extra 10 seconds to the timer.
I suspect its conflicting with the constrain attribute...
Any input is greatly appreciated.
Cheers

Comments

  • SocksSocks London, UK.Posts: 12,822Member
    edited June 2016

    Here's another way, make a real attribute 'A', set it to to 60:

    Loop: while A is > 0
    --Change A to A-(1/60)

    If you want to add 10 seconds to the timer simply use [Change A to A+10]

  • LivieGamesLivieGames Posts: 44Member

    @Socks ... Cool will give it a try.
    Cheers

  • LivieGamesLivieGames Posts: 44Member

    @Socks hey i tried it but doesn't seem to work, have added screen shot..
    I made a real game attribute myTimer set to 60 and added the rules to main character I can't seem to figure out why its not working

    Thankyou

  • LivieGamesLivieGames Posts: 44Member

    Sorry a bit hard to read...
    The change att: game.myTimer-(1/60)
    and the constrain att: game.myTimer -to- game.myTimer+10

    Should I make it a self attribute?

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

    @LivieGames said:
    @Socks hey i tried it but doesn't seem to work, have added screen shot.

    In my suggested code I am using a Loop . . .

    Loop: while A is > 0
    --Change A to A-(1/60)

    . . . from your screenshot it appears you are using a Rule instead.

  • LivieGamesLivieGames Posts: 44Member

    @Socks sorry my mistake, your right!!!! Woohoo
    Got it.. Thank you!

Sign In or Register to comment.