First of all hello! Hope you're havin' a fine day.
So I have a game with a large first level, but it isn't just the first level that sometimes stutters, I think it's the whole game. Or at least, some frames.
I know what you are thinking and I've already gone and read a bunch of optimization techniques. Don't worry I'm doing those, but I've also come up with a few questions of my own so I just wanted to throw these out there to see if some knowledgeable people could fill me in.
I was wondering if making every enemy invisible when they are off screen would help.
I have two lines that look like this:
Enemy is getting -16px from window's edge -> make invisible
Enemy is getting -0px from window's edge -> reappear
So my question is, is it worth it to have these two lines being checked every loop in order to make stuff invisible? I'll put these in a group that is only active when there is more than 0 enemies, as well.
Which leads me to my next question. I have an event that says:
Enemy = 0 -> Deactivate group "Enemy"
Would it be more efficient like this?
Enemy = 0
+Only one action when event loops -> Deactivate group "Enemy"
Is checking one condition and always doing one action more efficient than checking two conditions and not carrying out the action? (Other than the first time)