A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: 2 buttons in one ?

  1. #1
    Junior Member
    Join Date
    Nov 2015
    Posts
    6

    2 buttons in one ?

    How do I put 2 buttons into one

    Something like if i duck and press attak it plays a ducking attack animation
    i tried a couple of things but it didn't do what i wanted
    pls help

    Mfg FutureGamer

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Something simple like so maybe,

    PHP Code:
    attackButton.onPress = function()
    {
        if (
    thisVar == "Yes")
        {
            
    character.gotoAndStop(10);
        }
        if (
    thisVar == "No")
        {
            
    character.gotoAndStop(15);
        }
    };

    attackButton.onRelease = function()
    {
        
    character.gotoAndStop(1);
    }; 
    hopefully you will get the idea from that

  3. #3
    Junior Member
    Join Date
    Nov 2015
    Posts
    6
    under ''No'' is where i should put the the animation that it shouldn't play?
    and where do i have to put it under the ducking animation or under the ducking attack animation?
    Last edited by FutureGamer; 11-11-2015 at 03:39 PM.

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    That sir is for you to try to figure out.
    The code example above is not valid for the code on your other questions code, you need to rename items and vars to suit your game/project.

    It was purely an exampe of how one button could react to two different game states.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center