The factor holding me back is how the game state extracts information from the entity itself.
For example, it is usually easy to point the camera at the player: camera.x = player. x;But I’m not sure how you did that with component-based entities.
Any ideas or links to a system where you can easily get this kind of data?
This method should be simple and powerful enough to meet your needs.
final Camera camera = new Camera() ;
Player player = new Player() ;
player.OnMove += new MovementListener() {
public void onMove(Position newPosition) {
camera.UpdatePositionWith(newPosition)
}
}
I hope to help you.
I have been telling me recently The Flash framework has undergone some modifications. When I make a game every month, the idea of reusing components to quickly build concepts seems very attractive to me.
The factor that hinders me is the state of the game. How to extract information from the entity itself.
For example, it is usually easy to point the camera at the player: camera.x = player.x; but I’m not sure how you do it with component-based entities .
Any ideas or links to a system where you can easily obtain such data?
You can let components generate events and let interested parties register listeners for these events. For instances, your camera can listen to other components The action.
This method should be simple and powerful enough to meet your needs.
final Camera camera = new Camera() ;
Player player = new Player() ;
player.OnMove += new MovementListener() {
public void onMove(Position newPosition) {
camera.UpdatePositionWith(newPosition)
}< br /> }
I hope I can help you.