(01-21-2013, 02:09 AM)TheGreatCthulhu Wrote: Yeah, but if he needs to track if the player is within "area_2", and have separate logic (which uses this information) for when "Player"/"area_1"-collision is detected, than mixing these logically separate functionalities into one function creates unnecessary complexity and confusion in terms of code structure - it's just bad design. It's better to separate code that does two distinct jobs into two functions.
I don't see it as multiple and differing jobs, nor do i see it as any more complex than his current code. Player enters area -> activate monster in the area. Player leaves area ->
probably do something different. That's his current code. Even if there is one part of his code that is unique in comparison to the other callbacks that deal with the same thing, that can still be handled within one callback (with a local map variable and a conditional statement). Wrapping the same sequence of code into a separate function i see no significant difference in logic.