Sometimes it is good to streamline your events. Yeah. We know that.
I got inspired and over the last 1-2 weeks I have streamlined my game and shrunk down the events with 145 events! Yes, 145 events deleted!
If not for the optimization (which is not always true) it is mainly for the typo and overview thing. Having "basically repeated" code everywhere just with minor adjustments (for example to treat 4 or 8 directions, patterns etc) = higher risk to typos/accidents and worser overview. I also combined enemies behavior and object behavior and used more functions.
It required some thinking to solve some logic, and using math, also using loops in one place. But it feels good when I solved.
It feels good.
Yeah, it definitely is nice to figure out ways to reduce the number of events. The more I put effort into doing that, the more I come to enjoy organizing my events and in extension the whole game development process improves.
I'm also resorting to using more functions too, and then minimizing them so their events don't take up space.
Also, one thing that I always try to do is put my behaviors onto Families. I rarely put them on single objects. I also try to put instance variables on families too instead of directly on the objects. That way I can compare two object instances by referencing one from the family.
Develop games in your browser. Powerful, performant & highly capable.
I have yet to use families because I use one single sprite for all my stuff with exception for the player! ;D So I separate them by animation name.
hm, interesting.. I can't imagine doing that for everything. I guess it would depend on the type of game it is.
But even so, a family could still be useful; example:
+pick sprite by evaluating sprite.familyVariable = "red"
+pick family by evaluating family.familyVariable = "blue"
--+sprite is overlapping family
----+sprite.familyVariable = "purple"
----+family.familyVariable = "purple"
True enough. I am making a Boulder Dash-inspired game.
Also you know, you can make similar thing in different ways too.