Search Unity

Button combos with Up & Down?

Discussion in '2D' started by RuneShiStorm, Oct 17, 2017.

  1. RuneShiStorm

    RuneShiStorm

    Joined:
    Apr 28, 2017
    Posts:
    264
    Hi all!
    I'm trying to give my character an "uppercut" attack and I want it to be assigned to SQUARE and UP..
    My Code looks like:

    Code (csharp):
    1.  
    2.  public class Input
    3.     {
    4.         public const string HORIZONTAL = "Horizontal";
    5.         public const string VERTICAL = "Vertical";
    6.         public const string JUMP = "XBUTTON";
    7.         public const string PUNCH = "SQUARE"; // I WANT TO ADD SQUARE AND UP HERE
    8.         public const string UPPERCUT = "L1";
    9.     }
    10.  
    the PS4 controllers output looks like this
    SQUARE
    Square = joystick button 0

    Axes:
    LeftStickX = X-Axis
    LeftStickY = Y-Axis (Inverted?)
    RightStickX = 3rd Axis
    RightStickY = 4th Axis (Inverted?)

    I assign the buttons inside the Unity Input Controller... But I have no idea how to make combos..
    Do I have to code it or? Tricky question, but thanks for any help!
     
  2. supermoof

    supermoof

    Joined:
    Sep 24, 2015
    Posts:
    48
    Up is generally the Y-AXIS = 1 so you can do something like this.
    Code (CSharp):
    1. if(LeftStickY >= 1 && PUNCH)
    2. {
    3. Uppercut();
    4. }
    5.  
    Try checking this out as well, hopefully it helps you out.

    http://wiki.unity3d.com/index.php?title=KeyCombo
     
    RuneShiStorm likes this.