Creating A Reaction Timer

cracky6711cracky6711 Member Posts: 9
edited February 2013 in Working with GS (Mac)
I am currently creating an app which involves finding the users reaction time.
I have set up a scene with a big red square and i have a big green square (GreenPanel) as an actor.

Here are the terms:

Timer: Every 0.1 seconds Run To Completion
set: (game.SpawnTiming) to: random (1,10)


When: (game.SpawnTiming) = 1
spawn actor: GreenPanel


This system seems to activate before the scene is loaded so the green panel is always spawned before the user gets to the reaction timer scene. If i then go back and try again it works fine.

Another issue i'm having:

I want to save the reaction time as an attribute. I have created an attribute called ReactionTimer and GameTimer.
Here's what I have set up:

For the big red square:

Under the "When: (game.SpawnTiming) = 1"
i have: set (game.GameTimer) to 1


Terms for the green square:

if (game.GameTimer) = 1

every 0.1 seconds set (game.ReactionTimer) to (game.ReactionTimer)+0.1


when touch is pressed set (game.GameTimer) to 0.


In another scene I have a box which has a display text attribute set to display (game.ReactionTimer) however this just stays as 0.

If anyone could help I would much appreciate it!
Thanks

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Here's a demo.

    [I'm moving this out of Tech Support since it's not a support-related issue.]

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

  • cracky6711cracky6711 Member Posts: 9
    Yeah I wasn't too sure what category to put it under. Wow that example is perfect, still unsure why mine wasn't working but I probably made a mistake with the variables somewhere (possibly that I used int rather than real). Thanks a lot!
  • cracky6711cracky6711 Member Posts: 9
    edited February 2013
    Ok so I have now changed my project to have the exact same properties as your code except my red square has an integer attribute as opposed to an index attribute and it isnt working. My gamesalad doesnt seem to have the option to add an index but from what i have read it should really make a difference? Correct me if i'm wrong though!

    Would it be possible to send you a zip of my project?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Windows Creator does not have Index type attributes, but it's always fine to use Integer (as long as you're okay with possible negative values, depending on your rules).

    Sure, you can send me your project file. Compress it as a .zip file, upload it to a file-sharing service and then PM me with the link to download.

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

Sign In or Register to comment.