Roguelikes, players and our friend Ashley
Replay: https://www.livecoding.tv/video/libgdxjam-day-2-5/ and https://www.livecoding.tv/video/libgdxjam-day-2-6/
After working on maps, I worked on the player and how the user would control it.
I feel that this game is slowly evolving into some roguelike-style game. Take a look at my previous tweet earlier today: https://twitter.com/danirod93/status/6786681809450...
Let's talk about what do I expect to do with this. Remember that the player will have to slightly explore some planets. Not explore a complete planet, but there is a small map for every planet, with the antenna tower, resources and that. The player might as well just walk through the spaceship to find food or other resources or to kill any enemy trying to invade the vehicle. This is where the roguelike concepts like life, turn attacks and that could come good.
Now, if you read my previous post, you can see that I already have an OrthographicCamera setted up because of the Tiled Map rendering. How do I render the player?
I'm using Ashley. Although I knew about ECS engines before, I never worked with any ECS engine and it is the first time that I love with an engine like this. And I have to admit, that I'm in love with the Ashley library.
It is super easy to start once you read the docs. Just create a few components with the data, create a few systems, iterate through every entity implementing a given component in the systems, and you are done.
I find this a good alternative to Scene2D. Scene2D is also easy to set up and it gives you a lot of code already written so you don't have to deal with that, but it has the problem that most of the Actors end up having a lot of unrelated code inside of it. Using components, you can split your code into reusable small classes and then apply components only to the entities that makes sense.