Include another java class

Hello, I created a new java class, for checking his work I set the println, but when I started the project nothing is printed, why?
How I can include another class to the Main?
screen of mine java class

Hello friend :stuck_out_tongue:

Well seeing as how you have two Main Classes there they are both essentially independent programs.

  1. Because you have main methods in both they are both runnable on their own. So you’ll want to remove that method from your character controller class.

  2. If you want a method to run on creation of that class you’d use the constructor method of that object. Also an AppState has an initialize method.

The proper use would be to attach an application state on running your main class.

Sorry, but I don’t understood, how I can make characterController class not main and include it to the Main.class?((

This is regular old Java stuff and can be found by looking around the internet.

But in this case.

Your Main and CharacterController are different objects. By having these objects extend other things, you make them instances of those objects with some extra methods. Problem is you are extending SimpleApplication twice.

Your game is only one application.

So your Main.java should extend SimpleApplication and your CharacterController should extend AbstractAppState

You’d then create the CharacterController via stateManager.attach(new CharacterController());

Then you’d use a constructor method or override the initialize method to set all the fields of the CharacterController object you can also gain access to the update loop by overriding the update method.

Be sure to completely read the tutorials and have a good sense of Java before going too far.