I Am Not a Game Designer: Part 1 (or the diary of a guy learning to use GameMaker)
Well, I’ve spoken highly of Tom Francis’ GameMaker tutorial before. It’s great. Sadly, I’ve also caught up with it after watching all 16 episodes currently-available in about a week. What I ended up with was a reasonably-workable game, which – considering that I have done very, very little coding in my life – is actually pretty impressive. If you haven’t followed along, Franics has been demonstrating how to use GameMaker to make a game something akin to a twin stick shooter using the mouse and keyboard.
So I saved a separate instance of the game (so I can continue following along with the YouTube series when a new episode is posted) and decided that I would go about trying to make it into a different sort of game. I’ve already added a third enemy type (currently it is a weird bull head that charges, changes color and increases its speed when you shoot it and then dies on the second shot) in addition to the exploding and shrinking enemies from the YouTube series. I also tried to make the menu more usable by adding a return to game button and only showing the new game button if you are at the starting menu and made it where the enemies that survived multiple shots charge where you were when they were shot. There are several things that I want to do, though:
1. Make it where the player can only turn their head in a limited arc, since – currently – the game draws the head and the tail, but the head seems to rotate separately:
2. Making the spawns more balanced. The bulls are very fast currently and are also pretty common. Way too common, in fact.
3. Making the spawns come out in increasingly difficult waves. I’m not sure how to do this quite yet, but I think it should be doable. So, maybe the first wave is a single group of 10 enemies and the hardest waves are, say, five groups of 50 enemies each. Or something like that. We’ll see.
4. Redoing the menu screen. It works, which is amazing, but it is currently the bog-standard version made by Francis in the tutorial:
5. Having the game create a score of some sort that takes into account how long you survive and how many enemies you kill. This should include a leaderboard.
6. Make it where weapons are spawned throughout the game and are lost upon death, except for the single shot gun, which will be the default weapon.
7. Consider trying to figure out how to make procedural levels or make a set number of rooms that the game is played across. I’m not sure about this. I like the idea of having the levels be a little different, especially given the bouncing behaviors of the enemies.
8. Increase the number of weapon and enemy types. This is an easy add late in the cycle.
So, first-things-first, I want to limit the slug’s firing arc. I also decide that the game should be called War Slug, because that entertains me. In any case, the slug can currently turn its head 360 degrees to attack, which looks odd considering it is attached to a body. I create a variable called MaximumRotation and set it at 75 degrees. I think have the game figure out what the angle is created by where the mouse is and the current direction of the player. Then, I use a series of if statements to figure out if that angle is greater than, less than the negative MaximumRotation, or greater than the MaximumRotation and I set the Facing accordingly. I stare at the code and I’m pretty sure there is a much more elegant way to make it work using absolute values adn such, but it appears to be working perfectly and I’m a little afraid to change it. I lower the MaximumRotation from 75 to 60 and move on for the time being.
But, now, we have a problem. You see, the kick from one of the guns knocks us back by lowering our speed by a variable called Kick. But if this results in a negative speed, then that changes our direction and, as such, our Facing. And that is bad since our guy now has a limited shooting arc. The player does not expect, nor desire, to be facing a completely different direction after shooting. This one takes some doing. I try to keep it based on hspeed, but I am unable to make it work (I think about a couple of ways, but they seem reasonably complicated) and, instead, decide to change the player’s x and y values. This, of course, results in being able to clip through walls, which is not what we want to do. So, I set the code up to check to see if knocking us back will put us into intersection with a solid object and, if it does, to not do it. We still have screen shake and no one expected to be knocked back if they are against a wall. I add a small buffer as well (18 pixels) so that half of the player isn’t off screen before it stops.
I go ahead and adjust the spawn rate, making it seven exploding enemies to two shrinking enemies to one bull. That is probably too many exploding enemies, but the bulls are very fast in the current version, and definitely need to either be nerfed or less common. After playing for a bit, I also decide that I would like a way to make the War Slug faster, as well. But this should be good enough for right now. We’ll work on it some more tomorrow.