User Tag List

Results 1 to 5 of 5

Thread: Pressing a button twice

  1. #1
    No Products Registered

    Join Date
    Apr 2010
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pressing a button twice

    Hello everyone,

    I need some help in making the base of my game. I would like to make my character able to run by pressing a direction button twice (Press once and hold the second one) in a short period of time. How could I make that event?

    Thank you in advance.

  2. #2
    Clicker Multimedia Fusion 2

    Join Date
    Nov 2009
    Location
    center valley, PA
    Posts
    205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pressing a button twice

    id do something with "repete while key is pressed" it would look something like this if say shift was the button to run:

    repete while left arrow is pressed
    +repete while shift is pressed

    player>movement>set speed to 70

    if that dosent work im prety sure theres an extention for that called "control x" or control x 95

  3. #3
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    Stephen's Avatar
    Join Date
    Aug 2008
    Location
    Montana
    Posts
    4,515
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Pressing a button twice

    Chaos has an example of that type of movement on his site that uses the Platform Movement Object:

    Examples
    _____________________________________________
    Nivram's Examples -Need extensions? Send me a PM.-


  4. #4
    Clicker Fusion 2.5 Developer

    Join Date
    Oct 2006
    Location
    Finland
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pressing a button twice

    I don't know if there is more efficient way of doing it, but I've used alterable values for such actions in my game. I would do events like this:

    + if alterable value A > 0
    + every 0.01 seconds
    - substract 1 from alterable value A

    +if alterable value A < 50
    +player pressed direction
    - add 45 to alterable value A

    +if alterable value A > 50
    +repeat while player pressed direction
    - set alterable value A to 60

    +if alterable value A > 55
    - Set max speed to (whatever is your running speed)
    - Change animation sequence to running

    +if alterable value A = 0
    - set max speed to (your walking speed)

    +if alterable value A = 0
    +animation running is playing
    - restore animation sequence


    This means that every 0.01 seconds the alterable value is going 1 unit towards zero and if you press a direction it adds 25 to it. So if you tap direction twice in 0.40 seconds it goes over 30 and then holding a direction holds the value at 40 and the character runs. However you should take into account that you should zero the value if different direction than the last one is pressed or you have to have different counters for each direction. Otherwise it will go running if you change direction quickly.

  5. #5
    No Products Registered

    Join Date
    Apr 2010
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pressing a button twice

    Thanks for the help! I'll try them out as soon as I get home.

Similar Threads

  1. How to switch weapons by pressing a button
    By Warmachine in forum Multimedia Fusion 2 - Technical Support
    Replies: 29
    Last Post: 26th January 2010, 04:24 AM
  2. Upon pressing a Key
    By Rockdude in forum Extension Development
    Replies: 3
    Last Post: 30th August 2009, 10:35 PM
  3. Holding one button and pressing another
    By aeroshock in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 19th September 2008, 04:42 AM
  4. Confirmation to quit after pressing close button
    By McPhisto in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 8th December 2007, 01:46 AM
  5. Bug Upon pressing a key
    By Tyrael in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 22nd August 2006, 08:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •