Architecture – How does the game status interact with components?

I have been making some modifications to my Flash framework recently. When I make a game every month, the idea of ​​reusing components to quickly build concepts seems very attractive to me.

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?

You can let components generate events and let interested parties register to listen for these events For example, your camera can listen to the actions of other components.
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.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2915 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.