Very simple I'm sure.. But what is the smallest...

SaveDaveSaveDave Member Posts: 140
edited November -1 in Working with GS (Mac)
increment of tine that I can get a reading from in gamesalad?

Does this have to be done with a timer or can a smaller increment be measured with an integer?

Thanks

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    the smallest interval of time that an integer can read is 1 whole second. I would think if you used a real attribute it would all depend on the device.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    To expand on what scitunes has written, you would have to use a timer to get your necessary time interval, and the length of time as the result, if less than a second, must be put into a real attribute. Some programs used to/still do measure in ticks, but I think I'm right in saying that GS sticks to percentage of seconds, i.e milliseconds. I think.

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • SaveDaveSaveDave Member Posts: 140
    So how would I check if a sequence was touched in say under 3.25 seconds?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi SaveDave, I guess there'll be different approaches, depending on how you want to set up your system. One way would be (off the top of my head):

    New real Game Attribute called Timer. New integer Game Attribute called UserCount

    Have a start button for the sequence. Include in the Rules of that actor an integer Attribute called Counter. Each time one of the sequence is played, Change Attribute Counter To Counter+1.

    Your Rules for playing the sequence. add Rule: if Attribute Counter = 5 (for instance, if there are 5 parts to your sequence, say) then

    Timer: Every 0.1 seconds Change Attribute game.Timer to game.Timer+0.1 (i.e start timer just after sequence is shown)

    A Rule, if UserCount = 0 then Change Attribute game.Timer to 0

    In all of the sequence buttons, needs to be Rule When touch is pressed, Change Attribute game.UserCount To UserCount+1

    When UserCount=5 (for a 5 sequence) then
    When game.Timer > 3.25

    Change Attribute game.Timer To 0 (resets the timer just after the user has pressed the last one in the sequence)

    Display Text You Lost
    Otherwise
    Display Text You won

    This is just the timer bit of course, which would work whether or not the sequence pressed by the user was correct. But then I'm guessing you've already done the stuff for the correct sequence "detection".

    It probably needs refining/amending though, but I hope there's enough here for you to experiment with and get it up and running.

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Whoops, amended it wrongly, now won't let me edit it.

    After
    Your Rules for playing the sequence. add Rule: if Attribute Counter = 5 (for instance, if there are 5 parts to your sequence, say) then

    put

    Change Attribute Counter=0

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • SaveDaveSaveDave Member Posts: 140
    Okay.. This makes sense...

    So is it possible to display the global game timer as text??
  • SaveDaveSaveDave Member Posts: 140
    Ie. You can use every, after and equals with a timer but can you show the time in 0.01 increments then?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    I'm dashing out in five minutes so I'll have to be quick here!

    That'd be no problem; another attribute, boolean, when true, (true when timer starts), another actor to use behaviour Display Text; text to display: game.Timer. Think that should work.

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • ORBZORBZ Member Posts: 1,304
    There is self.time and game.time they are reals. You can get fractions of seconds from them. If you want to count the elapsed time between two events just store the first time interval in a variable, then subtract the diff:

    Event1

    FirstTime = game.time

    event2

    SecondTime = game.time

    Delay:

    SecondTime - FirstTime
  • SaveDaveSaveDave Member Posts: 140
    Okay.. Now I'm confused..

    What's the best way to time 0.01 second for a press of an actor appearing on screen???

    Can you time smaller that that even?
    Ie. 0.005
  • SaveDaveSaveDave Member Posts: 140
    Hundreths of seconds.. That's what I mean.. is that possible for the timer to read data from?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi; yes, 0.01's of a second can be got, pretty much certain. For most gameplay, you wouldn't need any smaller than that.
    SaveDave said:
    Okay.. Now I'm confused..

    What's the best way to time 0.01 second for a press of an actor appearing on screen???

    Bit confused myself, what you mean here; but based on the stuff I posted earlier, the timing bit is:

    Make game real attribute called Timer (OK, call it Time to avoid confusion with the behaviour called Timer)

    When touch is pressed
    Timer behaviour
    Every 0.01 secs
    Change Attribute Time to game.Time+0.01

    Hope that makes it a bit clearer for you. :-) (I didn't lay out the first explanation very well for clarity, sorry about that!)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • SaveDaveSaveDave Member Posts: 140
    What I need is smaller than that,.... Think 0.03 seconds....

    I need to be able to read times of less than 0.01

    In 0.03 second it shows times of three digits as milliseconds..

    This is what I really need.
    Is this a possibility?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Good morning Dave!
    SaveDave said:
    What I need is smaller than that,.... Think 0.03 seconds....

    Um, have to point out here that 0.03 isn't smaller than 0.1, but 3 times larger... Did you mean 0.003? If so, I don't know if GS can "get" that or not.

    Perhaps try with 0.01 seconds and see how responsive it is. I'm guessing you'll find it more than OK...

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Just found a template by tshirtbooth which might help you:

    http://gamesalad.com/game/play/82566

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • SaveDaveSaveDave Member Posts: 140
    Nice one gyro... Really appreciate all the help.
Sign In or Register to comment.