making a character run

pipepipe Member Posts: 54
i can make my character walk if you press a button once but I want my character to run when you press the button twice and hold

Comments

  • charliehgreencharliehgreen ArizonaMember Posts: 233
    i can make my character walk if you press a button once but I want my character to run when you press the button twice and hold
    I want to know this as well :)

    Please help us lol

  • pipepipe Member Posts: 54
    sorry but I cant open the file can you post the project
  • GS_MasterGS_Master Member Posts: 159
    lol wtf let me try to upload it again...
  • GS_MasterGS_Master Member Posts: 159
    edited May 2013
    when you start it the button is on the bottom right
  • pipepipe Member Posts: 54
    here send the files in here rfstickrungamer@gmail.com
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    To answer your question, you'll need to change the value of an attribute (a boolean) when the player presses the button AND a certain amount of time has elapsed. Here's a rough idea of how to do it:

    Create a real attribute called self.touchTime and set it to some huge number (e.g. 999999).

    When touch is pressed
         Change Attribute self.touchTime to self.Time
         When self.Time > self.TouchTime+2
              [behavior to make the player run]
    Otherwise
         Change Attribute self.touchTime to self.Time+999999

    The +2 forces the player to hold the button down for 2 seconds. You could make it 1 second or 0.6 seconds or whatever you prefer.

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

  • pipepipe Member Posts: 54
    :D thanks figured it out /closed
  • GS_MasterGS_Master Member Posts: 159
    Hahahaha dude only moderators can close threads.
Sign In or Register to comment.