Fire's Time demo - errr. how to countdown instead of up

StormtrixStormtrix Member Posts: 256
edited November -1 in Working with GS (Mac)
Trying to work with Firemaplegames's Time demo - http://gamesalad.com/game/play/34021
and using the custom font. But looking to just countdown from either 2min, 3min, or 5min as options and when you reach 0:00 then end game.

never worked with the 'floor' option and game.time any thoughts? :)

thx.

Comments

  • JackBQuickJackBQuick Member Posts: 524
    Also check out:

    ClockAndRandom(Demo)
  • StormtrixStormtrix Member Posts: 256
    thx for the reply jackB,
    i can change that demo to countdown from like 2min but still not sure how to incorporate a custom font/graphic with it having seperate images for the digit locations.
    hmmm.
    then if there are seperate graphic digits how to make the rule of when you hit 0:00 then do something..
  • JackBQuickJackBQuick Member Posts: 524
    I haven't tried this but:

    CodeMonkey's ClockAndRandom(Demo) will show you how to countdown from a set length of time. I think that you will need to separate out each digit and save them individually to game attributes.

    So, in the equation, the part that reads:

    floor(( self.MaxSeconds - game.Time )/3600)

    represents the hour. The next two parts represents the minutes; and the final pair of numbers represents the seconds. You will have five game attributes.

    Then, you can use Firemaplegames's Custom Font DEMO to apply a custom font to the time counting down. He provides a very good explanation of how to use it in the score_glyphs actor. You will have five glyphs on the screen, and pair up each with one of the five game attributes you created in the first step.

    Good luck!
  • JackBQuickJackBQuick Member Posts: 524
    Darn, I wasn't thinking clearly in my last post. Sorry.

    I know the answer lies in combining CodeMonkey's ClockAndRandom(Demo) and Firemaplegames's Custom Font DEMO but I'm so tired now that I won't even attempt another explanation. (I wanted to delete my last post but couldn't.)

    Anybody else want to give it a try? Off to bed for me.
  • stanimationstanimation Member Posts: 406
    I used FMG's demo for the same thing. This is what I did.
    made a "clock" attribute that is set to 30.
    made a "clock" actor that has a timer set to "every 0.01" second, change attribute of game.clock
    to game.clock-0.1

    try that and thanks to FMG!
  • JackBQuickJackBQuick Member Posts: 524
    I know that Stormtrix has found a solution to this. However, for others trying to do the same thing, I've uploaded the following:

    Countdown Timer with Custom Fonts

    Have fun!
  • StormtrixStormtrix Member Posts: 256
    Wow Jack... nice job.. uh.. considerably less code then mine.. which means...aaaaah darn it
    going to may switch mine to yours ;) nice work.
  • StormtrixStormtrix Member Posts: 256
    Hey Jack,
    Hoping you'll get this... implemented your version of the countdown in my game and now just trying to figure when i hit pause the game.timer is still running in the background and unpausing the time just jumps to what it really is while it was paused.

    trying to figure out how to capture what the game.time was at paused state and which actor to put the statement into.. after i can get that done it's submit to apple time :)
  • JackBQuickJackBQuick Member Posts: 524
    I didn't implement any pausing in my demo but I vaguely recall that one of the other demos (CodeMonkey's or Firemaplegames's) might have had something like that. Sorry, I'm not on a Mac right now :)
  • StormtrixStormtrix Member Posts: 256
    ya.. i'm looking at FMG's http://gamesalad.com/game/play/34237
    trying to decipher it now :)

    He has 2 'real' attributes StartCaptureTime and CapturedTime

    Pause Actor has -
    For unPaused ... Change Attribute -
    game.capturedtime to game.capturedtime+(game.time - game.startcapturetime)

    For Paused ... Change Attribute -
    game.startcapturedtime to game.time

    What gets me is on the rolling time actor he has.
    Display Text
    floor((floor(( game.Time - game.capturedTime )%3600)/60)%10)..":"..floor((( game.Time - game.capturedTime )%60)/10)..floor(( game.Time - game.capturedTime )%10

    but do i add in the 2 attributes to your demo and put instead of maxseconds, put captured time on each of the scoring_glyphs

    like your first digit shows
    "Scoring_"..floor(( game.maxSeconds -( game.Time - game.timestart ))%10)..".png"

    hmmmm.
  • JackBQuickJackBQuick Member Posts: 524
    If I remember correctly, I have an attribute called game.timestart. This is equivalent to game.capturedtime.

    You need to create and capture the game.startcapturedtime attribute.

    I don't think that you need to change anything in the glyphs.

    In Firemaplegames's example, changing game.capturedtime to game.capturedtime+(game.time - game.startcapturetime) should make the countdown continue seemlessly afterwards. (You should make the necessary edits to conform the attribute names to what you have.)

    Hope this helps :)
  • StormtrixStormtrix Member Posts: 256
    holy crap, i got it :)
    JackBQuick and FMG is my credits now.. lol.. HUGE help.. Thanks so much !!

    so... pause actor

    If game.pause = 0
    Change Attribute --
    game.timestart to game.Time +( game.timestart - game.startcapturedtime )

    if game.pause = 1
    Change Attribute --
    game.startcapturedtime to game.time
  • JackBQuickJackBQuick Member Posts: 524
    Sorry, there's a few things that you have to change. For example, you have to stop the glyphs from updating, and you also need to get your pause button to recognize whether the player touched it once or twice, etc.

    I won't be back to my computer for another six hours. Factor in another hour for delays, etc. So, if you can wait seven hours, I'll try to update my demo.

    If you have figured it out by then, please post an update.
  • StormtrixStormtrix Member Posts: 256
    i got it Jack.. just edited my post above you.. lol.. it's working.
  • JackBQuickJackBQuick Member Posts: 524
    Fantastic! I'm glad it all worked out. Good luck on your submission to Apple.
Sign In or Register to comment.