Weapon Powerups and Utility Functions
An explosion of powerups, as predicted, would follow, and made the game way more interesting to play (and made replayability a thing, since it had very, very gentle rogue-like elements now). Slowing down the player was also a decision I’m happy with in retrospect, as it made precision and deliberate control much more important.
I think the issue I was facing that led me to try to implement iterators was that on player death, I needed to go through all possible held powerups and remove them from the inventory as well as spit them out from the player’s location in a random direction. Inventory was being held in a key-value-pair structure that had no native to iterate through in GML, infuriatingly. After building an iterator function, I discovered that closures were extremely limited in GML too, so I couldn’t use it as expected. In the end, I created a separate array to track possible powerup inventory keys, then I iterated through that array and checked the powerup inventory key of the element I was on. It worked, but YUCK.
2021-10-19 11:35 PM On the 17th, I implemented powerups for the weapons (speed, power, persistence across the screen-wrap (“void”)) and added a fly new particle effect for the more powerful impacts. I also implemented a system for dropping held powerups on death, but it was all pretty kludgey and fragile.
On the 18th, I added powerups for points and did the art for the other “module”-style powerups (extra lives, braking). My goal was to drop points whenever a powerup drop would have been something already held. This led to a bunch of pain that I couldn’t resolve at the time.
Today, since Javascript-callbacks are available in the current version of GMS, I implemented some quality-of-life utility iterator functions for structs and arrays, and then didn’t really use them to fix the issue with the drop table. It’s all working now, and I’m ready to build new powerups (engines and turning would be nice). I reduced max speed to 3 from 5 for better control; thrust-speed up will probably put it to 4.