After reading an article in the Slick manual concerning components, i see that it makes absolute sense, for entities to be composed of multiple components. In extension of that, i have added components and two initial components, also outlined in concept in the article. Though my implementation is different.
ImageRenderComponent takes the path of the image to render as an argument and the map, so it can calculate the absolute position of it's owner. On every call to the render method, the image is drawn on screen and has the potential of added orientation and scale down the line. I will probably add an AnimationRenderComponent later on as well, so entities can be represented by an animation.
MovementComponent handles pathfinding using the Slick pathfinding algorithm. The destination is updated on click (event registered elsewhere). It then moves step by step following the path located by the algorithm.
No comments:
Post a Comment