At 5/5/13 10:15 AM, FlyingColours wrote:
At 5/4/13 04:57 PM, PSvils wrote:
Just got that super warm, fuzzy feeling when I've been thinking about how to design a certain thing for aaaages (In this case my inventory system), and then suddenly it all clicks, and you realize you're whole approach is wrong, and the new way is so...so beautiful!How did you do it?
Well before I was using Flash mouse events directly in my code for each entity that needed them.
But know, I have an InputSystem that runs before all my other systems, that pumps any kind of input events through the other systems. So when my MovementSystem processes, it checks if there are any related key events present. Same thing then applies to my inventory system, it checks if the correct key has been pressed, and if it has, then it'll show the current Entity's inventory!
This also makes key bindings easier, since I don't need to add/remove key listeners in the bind code itself, I can change it whenever, which will change which keys the MovementSystem listens to.
If none of what I wrote made sense, I can continue to explain, but it's tightly related to Entity Systems, so go check those out first :D