calculating time between touch pressed and touch released?

joelEjoelE Member Posts: 30
edited November -1 in Working with GS (Mac)
is it possible to calculate the time between touch pressed and touch released.

i have tried constraining self.time to 0 but cant work out how to get it to start when touch is pressed.

any help would be great and perhaps prevent me from launching the mac off the roof of my building....I already have a target set up with flashing lights and a bullseye.

Comments

  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    If you do the launch, make sure you film it for YouTube ;)

    I've not played around with the game time hugely but I'm guessing this would work:

    Create a real attribute called timeStart, one called timeEnd and one called timeTotal then when touch is pressed change attribute timeStart to game.time then when touch is released change attribute timeEnd to game.time and then set a timer after 0.05 seconds (this is so it registers the end attribute in time) change attribute timeTotal to timeStart - timeEnd.

    Now timeTotal is how long the user had their finger touched

    Ace
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    Actually you can bypass the end attribute and just do when touch is released change attribute timeTotal to game.time - timeStart.

    This way you can miss out the timer and avoid misstriggers.

    Ace
  • joelEjoelE Member Posts: 30
    Muchos gracias Ace,

    i'll give it a go,

    I've also added a pa system with a fanfare should this not be the solution.
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    I'll bring some hookers and crack and we'll turn it in to a Charlie Sheen party!

    Ace
  • joelEjoelE Member Posts: 30
    Get then H'os on speed dial Ace, Call up the Warlock and lets get this party started.

    controlling time is a bitch.

    I'm gonna go and crack my head on the sink and see if that musters up any ideas.

    would it matter if i created self attributes and controlled the actors time rather than the game time?
    I mean i've done this and it made no difference so not sure why i'm asking really. desperation i suppose.
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    Let me play around with GS for a minute and I'll get back to you, see if I can get this working (although I'm quite looking forward to the party of epic winning proportions, so that's putting me off helping you a little haha)

    Ace
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    Touch and hold down on the green button and it'll tell you the time you had it held down for when you release.

    Ace
  • joelEjoelE Member Posts: 30
    Sorry Ace did you say something..charlie is just wondering where the hell you are with the crack..

    Bring your Guitar aswell and we'll crank out some warrent! haha.

    Thanks a pant load for your help on this. the example file is great, i appreciate the time. now if you will excuse me Brandy and Megan require my service.
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    Haha, I'm on my way with a guitar case and some 7 gram rocks ;) haha

    Not a problem buddy... Any time :)

    Ace
  • joelEjoelE Member Posts: 30
    If i can be serious for a moment-

    This is exactly what Ive been looking for and trying to figure out.

    my productivity is back on track .
Sign In or Register to comment.