best practice for... time since pressed

morphinegamingmachinemorphinegamingmachine Member, PRO Posts: 449
edited February 2012 in Working with GS (Mac)
want to save the time in seconds and minutes since pressed that updates in real time... best practice besides lots of contraints?

Comments

  • morphinegamingmachinemorphinegamingmachine Member, PRO Posts: 449
    what i just tried defiantly didn't work, constraining time difference to time current time sec-pressed time sec depending on what second u started would count up, then not get to 60 it would get to like 56 and then go to -4 or go to 28 then to -32

    whats the best way besides every second adding to score as time?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited February 2012
    touch is pressed --> game.PressedTime=game.Time
    every 0 seconds --> game.TimeSincePressed=game.Time-game.PressedTime
    ... and then convert game.TimeSincePressed to minutes and seconds using a tshirtbooth technique:



    Is that what you're looking for? It still uses an every 0 seconds timer.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • MotherHooseMotherHoose Member Posts: 2,456
    MGM
    the button itself has a timer: self.Time … tracks time in seconds and milliseconds
    the button has self.Tags to use as a 2nd conditionControl … should be blank for this purpose

    -add an attribute real-type to the button: pressedTime

    on the button:
    Rule: when (All)
    Event: touch is pressed
    Attribute: self.Tags is blank
    --changeAttribute: self.pressedTime To: self.Time
    --changeAttribute: self.Tags To: pressed … just type-in as it is text

    Rule: when (All)
    Attribute: self.Tags is pressed
    Attribute: self.Time > pressedTime+10 … (the 10 is 10 seconds … could be any number you like … remember a whole number here is seconds )
    --do This
    --do That
    --changeAttribute: self.Tags To: leave blank
    --changeAttribute: self.pressedTime To: 0

    ===
    use what the computer is already tracking
    use the gameAttributes to initiate/store gameWide events/attributes
    use player's interaction with an element/actor in your game … to control/run the events

    @};- MH
Sign In or Register to comment.