Java Classes

Is it possible to create a class that hold the model,and properties only and not a control?

So say I have a class Ship which contains the ships’s design/model and contain the basic fields/properties like speed,health,amount of ammo etc.

So like Ship ship = new Ship() will spawn a ship.

Then I can add control classes to it like navigation control,combat control etc.

yes.

1 Like

You can but you shouldn’t.

This gets into larger discussion of game objects versus visualization objects that may be beyond your current abilities. Hard to say for sure.

Yeah, separating into classes just to “have the code in one (different) file” doesn’t make sense really, the code logic should dictate what belongs to one class and what to another. If you don’t see how that connects, simply having one huge main class is probably better for beginners.

Alright, thanks guys! I’ll just make them spatials.