-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Scene events #39
Comments
For now, the only way to handle input is through event listeners. If you need to bind the input to a specific class, you need to write a wrapper yourself. I am still experimenting with different approaches. What do you suggest? |
Sorry for the delayed response. Handling events in the scene level could be quite messy as I can see it - especially if you're going to build a whole level with it - perhaps I see it wrong, I would be more than glad to see what you have in mind about that. |
You can handle them in actor level by adding event callbacks to your actor or component. Sending all events to ALL actors or components is really time-consuming (iterating through all the actors in the scene and calling methods for each of them) and we don't want this. |
Yeah, that's a trade of - but I think readability-wise might worth it. |
Hi Elvis,
I was inspecting the samples project and I was wondering,
you have a single event handler for each type (keyboard, mouse, etc) per a scene - if you have 500 npcs of different types in 1 scene how do you manage their behavior (response) to each event that is sent in a organized and comfortable way?
I mean, how can you handle game logic easily this way?
if player attacks mob, where do you handle its response logic?
Or if a user clicks the right arrow button,
You do all the logic inside the scene’s handleKeyboardEvent method?
Shouldn’t the player input handling be encapsulated?
Thanks in advance
The text was updated successfully, but these errors were encountered: