Most of the controllers will automatically play nice with each other; at worst cancelling each other out when two opposing directions are input. The only real exception to this is the CameraFollowControls. If it has a followObj set, then it's pretty much active all of the time. In order for us to let the others play as well, as soon as one of them trigger their signalOnStartedMoving Signal, the followObj for the CameraFollowControls is set to null. We reset it when we click on a ship.
This is a pretty nice behaviour, as it will follow selected objects by default, but when you want manual control, it hands it over, no fuss.
There's no code listing for this post; instead you get the full project to play around with. What it includes:
The Camera class, all its controllers, and related files
The different helper classes, such as Input, MathHelper, and Update
A Main class for each entry in this series, showing you how to set up the classes
To test any project in particular, just set the relevant Main class as your document class.
All the controllers in action; click on the stage to give it focus, then click to select/deselect the ships. Once a ship is selected, you can click again on the stage to move the ship there. When a ship is selected, the camera will automatically track it, until you move it otherwise (using the screen edges, mouse, or keyboard)
Colony mailing list
This technical update was for my Colony project. If it seems like something you would be interested in, or you'd like to get an email with other updates are posted, sign up to mailing list! No spam; indie-dev honour!