Ok! Time for a real update. Time to fuckle with lasers. First order of business is to change the lasers the enemies fire to not be tied to the game time but to a random variable (though technically most random variables are themselves randomly done by the clock) but by using a random variable I should have greater control over when they fire (if only because a lot of the game time stuff they used I wasn't completely familiar with!)
I have to decide exactly how often I want the enemies to fire. Once when they spawn? Half of them fire once when they spawn? I want there to be a decent about of fire and what exists now is ok but not perfect. I'm more concerned about how often the boss fires which is definitely not enough. Regardless I will probably need two sets of fire instructions for the enemy projectile, one for the boss and one for the other enemies (possibly one for each type of enemy).
So first I need to change it for the boss. Since the firing logic is in the update enemies part and each type of enemy gets their own thing, the boss's firing code is conveniently separate from the enemy firing code.
Simply removing the if statement for the boss (aka it fires every time he is checked) created a wave of laser death not unlike a sideways Touhou, except with no actually way to dodge it.
It didn't like me straight up saying if (random > 30000) then fire the laser (I thought I recalled the average random number generator going up to 32,000 or so, so I figured that even if it checked the update function a ton, if I made the requirement unlikely enough I could get a dodgable yet increased fire rate.
I then tried to use the old gametime stuff but to divide one of the parts of it by 2 to make the firing happen more often but it gave me a bitch fest when I tried.
I set the bosscounter to 9 to speed testing up, tried playing with Elapsed game time since I can do operations on gametime stuff but can't use numbers themselves.
In a great Sixty tradition I solved the problem by adding a counter. Every time the update method is checked the counter goes up, when the counter is greater than 20 it fires and resets. I can increase or decrease the rate of fire by changing what the counter needs to be at for it to fire. Simple enough, no idea why I spent so long messing around with gametime crap.
No comments:
Post a Comment