I want to use Ashley but I also want to use actions and listeners with Scene2d. I read that it is not a good idea, but why? Ican create a system with stage.act(); and stage.draw(); in the update method or is it a bad idea? Thanks.
1 Answer
I don't think you can say it's always a bad idea to mix Scene2D and an ECS like Ashley. It may make a lot of sense to use Scene2D.UI for your user interface, and then Ashley for everything else. As you point out, there isn't a technical reason why you couldn't tie these two together. It's a judgment call based on your particular use case.
That being said, one reason why you typically wouldn't use Scene2D and Ashley together is that they have a lot of overlap. One of the basic principles of computer science is "Don't Repeat Yourself"- don't build the same thing twice, and when you do build something, make sure you use as few parts as possible. This includes avoiding libraries you don't need.
If you use Scene2D's actions to move your actors/entities, and you use Stage#draw() to draw everything, what's left for Ashley to add? Likely not enough to justify the complexity it adds.
-
\$\begingroup\$ Thanks! Maybe I should use my own system of 'Actions' in Ashley? \$\endgroup\$ Commented Dec 18, 2016 at 11:04