omarshariff wrote:I didn't realize that the event system was restricted to love only, the wiki doesn't make this distinction. In fact, the wiki appears to suggest that the love.event objects and functions are available to regular developers for use. Could you please expand on why you think this is an abuse of the event system? I thought that my approach was quite clean and elegant, unless I have misunderstood the purpose of the event system. Could you explain?
love.event is for passing events such as key down, a mouse click or quitting the game from the lower depths to their handler (love.keypressed, love.mousepressed, etc.)
The only thing you'll usually push is 'q', to quit the game.
What you're trying to do is normally done by functions.
Code: Select all
-- do something
omarshariff wrote:And to answer Tesselodes question, I was hoping to take advantage of the event system so that I could ensure a seperation of concerns. You see, in my program I am attempting to seperate the input controllers (joysticks) and AI controllers (AI inputs) so that my characters can be controled by either. I've done this by reducing the various outputs from each to simple instructions (MOVELEFT, FIRERIGHT, etc). I was hoping that I would be able to simplify things and ensure this speration by having the various characters/sprites listen for events. That way, I should be able to swap an AI controller character with a joystick controlled character at runtime.
Still, plain old functions do this excellently.
Otherwise, I think there are libraries that implement something like you want. (kikito, one of yours maybe?)
I don't think we ever had anyone else misunderstand the purpose of love.event, but perhaps it would be good to explain on the wiki that it mostly takes a passive role, rather than an active one, and only in relation to system events, as opposed to game events.