You would be better off creating a new class for the "Shooter" object and have that contain such methods as "shoot()" and "aim()". For example:
Code:
public class Shooter {
public Shooter() {
//initialization code goes here
}
public void shoot() {
//code goes here
}
public void aim() {
//code goes here
}
}
Then in your main class:
Code:
public class Main extends RobotMain {
Shooter shooter;
public void robotInit() {
shooter = new Shooter();
}
public void teleopPeriodic() {
shooter.aim();
shooter.shoot();
}
}
Calling a method in teleopInit() is not recommended because it is only called once, when the robot enters teleop period. You would be better off calling it in teleopPeriodic, which updates about every 50 ms, or in teleopContinuous, which updates as fast as possible.
You should also take a look at the
Java tutorials Oracle has on their website to learn the basics of Java.