Which leads to the first obstacle, and something I've done that's bloody stupid, for me. I've gone for an Ultima style isometric movement. And it ain't steps. What problems does that create? Well, I'm still only moving in eight directions, that's fine, and that was easily coded round with just the basic event handling that GMS is good at (and I fondly remember from my Games Factory days back in school.) But collision, and how you handle butting your head into a wall, is another matter entirely. That requires some scripting, and I've got to write this stuff down to make sure I've got it right. Also, y'know, test it...
Duder McMann in... The Dimension of I'm Getting Used To That Pattern Now...
In any case, what I have right now is that if you hit a wall, you just stop. Dead stop. You can't move along the wall, you can't move into the wall, and only half of that is what I want. But there isn't a way to do that with basic event handling. You can bounce, or you can stop, those are your choices. So something has to be done, and it can only be done in script. I just checked that, to be certain.
So the key to any program thing is what, precisely and logically, do you want to happen? In this particular case, I want the following to get checked, in order:
- Is there a collision between my dude and the wall?
- If so, am I holding a diagonal (IE - up-left, up-right in the case of a wall I bumped into from the bottom.)?
- If I'm holding a diagonal, keep me moving horizontally, but not vertically (or vice versa, in the case of a side collision)
...Bet that didn't make sense, did it? But in a programming sense, yes, it does. Because if we were to check for up, and then left or right at the same time, if we pressed either, it would act as if we pressed all three at the same time. If you check for left, then right, you're adding unnecessary steps. Come to think of it, I haven't tested what happens when you hold up and down, or left and right, both at the same time.
...Cool, it did exactly what I expected it to do (the relative position changes cancelled each other out, as they should.) Don't expect a program to do what you expect it to do if you wrote it. Always check. Anyways... If you check things a little differently, you can cut between eight and sixteen direction checks down to four.
- Okay, I'm hitting something. Am I still moving in the direction of the wall? (1)
- Yes, I am. Is the keyboard telling the PC that left and right aren't being held down? (2)
- Ah, okay, it isn't. Is it moving left or right? (3, 4)
- If it's moving left, move me left while not letting me move up. If it's moving right, move me right without letting me move up. Simple!
This, ladies and gentlefolks, is just one of the many mini dilemmas you face when your scripting is somewhat rusty (I'm not going to call it programming), and you need more than what simple tools will provide. Speaking of, I still haven't checked out how to rebind keys... :D
POST SCRIPTUM: For some reason, Duder McMann (my generic name for a protagonist) is having a little trouble standing facing down-right. The moment I hit right, he faces away... I suspect cutting even more might be an idea if I want to make this by sunday evening... Time to change the concept some more.
Duder McMann, in the pose you'll never see unless you move diagonally down-right.