Quote:
Originally Posted by olidem123
I use 2 commands because I found it easier to set up 2 buttons to one command each.
|
Well you'd have a constructor parameter that specifies which direction to roll the ball.
Code:
public enum Direction {
IN,
OUT
}
// ...
public class BallCommand extends Command {
Direction whichDirection;
public MyCommand(Direction whichDirection){
this.whichDirection = whichDirection;
}
// ...
}
// ...
// then in OI
Button buttonA = new JoystickButton(stick, 1),
buttonY = new JoystickButton(stick, 4);
buttonA.whenPressed(new BallCommand(Direction.IN));
buttonY.whenPressed(new BallCommand(Direction.OUT));