Much progress was made today! I am fairly pleased.
I had many more hours to work today, so I got to really get stuck into the Game Maker scripting language, as I had hoped to do. As it turns out, I’m coming up to speed with it pretty fast, so let’s look over at what I did today.
Firstly, I got the health system working. As it turns out, the built-in system seems to be focused mainly on one of your objects. It took me close to an hour to figure out that the variable ‘health’ is a reserved word, and tracks a value from 1-100. I was very annoyed at my skeletons who just wouldn’t die, because their health was 100, and then eventually they all died, because the global health variable was zero. So anyway, skeletons have ‘stam’ now, not health.
Bit of a detour: A corollary to the health system was learning to write text to the screen. That took quite some time too because I, at some point, had made the object responsible for writing invisible, so nothing I tried worked. Obviously. But after sorting that out, I quickly came up with a total health display. Ok, back on the skeletons. I wanted them to be dangerous, so any time the player is standing next to a skelly, they will do some damage at intervals and within a range randomly selected. So if the player just stands next to the immobile skeleton, the player-character’s health runs down. (Come to think of it, I haven’t actually programmed anything to happen with the player’s health reaches zero. Hmmm.)
Having worked that out, I decided these little buggers needed to move around. Now, pathing is another function Game Maker supports with the drag and drop interface, but like I’ve said I’m avoiding all that. Also, the paths don’t really jive with a more or less grid-based system I’ve decided on. So I had to code a simple AI behaviour by hand. Basically, the skeletons are idiots with no real goals. They just randomly pick one of the four compass directions and take a step if they can, then rest for a few dozen milliseconds. If the player character is next door, however, they will stay put and cause the player some damage!!
I had a lot of trouble with the case switch in my skeletons, which manifested in all the skeletons eventually moving through the whole set of cases, and winding up in the bottom left corner of the room. “Break;” is a pretty important function, if you didn’t know. All that took quite a while and got a bit frustrating, I’m not embarrassed to admit.
From then I had a pretty smooth time of implementing a locked door (an impassable tile with a lock-looking sprite) and a key with which to unlock it. Took a few tries to figure out how to make it all interact the way I wanted—for example, in my first iteration my character had to stand on top of the non-solid door tile for it to work, which just looked kinda wrong. Had a brainwave eventually, and now the player just clicks the door when he’s near enough and has the gold key—a bit like attacking the skeletons.
The last thing I actually implemented today was a health potion. Pretty simple, the player just walks on it and gains 10 health, but can’t go over 100.
From there on I really only did a couple cosmetic changes, browsing through the sprites included with Game Maker. I did make my own key sprite, having not seen the ones packaged in the folders already. It is pretty ugly, but it’s a pretty straight forward process.
Now, I’m to a point where I have basic, absolutely essential mechanics in place, so I’m back to brainstorming. What do I want to do to this framework? Do I want any kind of inventory system beyond a yes/no on keys? Do I want equipment or levelling up? Do I want any skills beyond left-clicking objects in the game world? And a fairly major question is about interface. At the moment, the only interface I have that isn’t the gameworld is a strip at the top with health, score and the single line of messages. Shall I create some kind of sidebar with an inventory and message panel? An action bar? These are fairly significant questions! I will have to think about them.
Finally, I went online again and had a look at one feature I quite like, and may have to figure out a way to implement: a light-based line-of-site system. Nothing fancy, but basically, to give a sense of exploration, I feel it would be effective to limit the player’s range of vision. At the moment, the player can see everything in the room at once. If, instead, you could only see four or five tiles in any direction, this would be much more of a ‘dungeon crawler’ suddenly. However, the function I looked up was pretty complex (relatively) and required the Pro version of Game Maker. I’m not really opposed to buying the full version, but I do want to understand what’s going on. So I’ve decided I won’t add any functions in through copy/pasting someone else’s work. The whole point of this is to be learning, so I want to learn, and hopefully internalise some of this, rather than just trust Google to fix all my problems.