another newbie question "button up/released"

joelEjoelE Member Posts: 30
edited November -1 in Working with GS (Mac)
Am i right in thinking we can't apply timers to the amount of time a button has been released.

i am trying to create a command that when a button is pressed the actor crouches and moves right. when button is released the actor jumps straight up.

my question is- Can i control the height of the jump on release in relation to how long the button was pressed.

ie, button pressed for 1 sec or less, on release actor accelerates 200 up if pressed for 2 secs or more on release actor accelerates 400 up.

I have messed around with this for a few days and have come to the conclusion that it's not possible.

Comments

  • calvin9403calvin9403 Member Posts: 3,186
    use timer
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    You could use a timer where every 1 second, change attribute (make an integer attribute called jumpcount) 'jumpcount' to jumpcount + 1 then have it if jumpcount=1 jump so high, if = 2 jump higher, etc. When he jumps, reset 'jumpcount' to 0.

    Ace
  • joelEjoelE Member Posts: 30
    thanks Calvin,

    I'm trying timers i think the answer is in there somewhere.

    cheers
  • joelEjoelE Member Posts: 30
    thanks Ace,

    thats sounds like just the thing.

    cheers
  • Rob2Rob2 Member Posts: 2,402
    or just grab self.time when button is pressed and subtract that from self.time when button is released and use the result as a factor in a power calculation for your acceleration.
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    Rob2 said:
    or just grab self.time when button is pressed and subtract that from self.time when button is released and use the result as a factor in a power calculation for your acceleration.

    +1

    Ace
  • joelEjoelE Member Posts: 30
    rob, if could you elaborate on how i would "grab" when button is pressed I really appreciate it.

    thanks and sorry for the newbieequeness of my quanderings.
  • Rob2Rob2 Member Posts: 2,402
    'grab' = assign to an attribute or store for later use :)
  • joelEjoelE Member Posts: 30
    yeah, so if i want to calculate the time between button pressed and button released i would go into the actor and.....?

    i am trying to work it out for myself but im going round circles and the fuse is burning....self-distruct is surly imminent

    please tell me.. go on.. please
  • joelEjoelE Member Posts: 30
    can anyone help me calculate the time between touch is pressed and touch is released?
Sign In or Register to comment.