Well, Sort Of . . .
Welcome back to my game development series, this post may take a lot longer than normal. Why? Well the topic is a lot more in depth. Last time, I picked out the asset I’ll be using for my main character. And now it’s time for me to actually start making a game! So what I’m going to need is a character, a location, and a way to control movement.
So there I go, click that new button and set my project details. First thing’s first, add in my ninja sprite and setup a couple animations. . . hmm, something’s missing . . . Yeah, I’ve already edited the sprite sheet and added my own little animation. Now the sucker can duck.
After that I imported a nice looking office tilemap. Sliced it all up and began to work on testing it. . . However there’s a slight problem I’m running into. I can’t seem to figure out how to use that tilemap and setup proper colliders and physics. Hmm, this is harder than I thought.
Welp, upon further inspection, that tileset just won’t work. At least not without a ton of headaches, maybe. Maybe I just need to do a little tweak? Hmm, what if I add my own “Floor” and “Roof” tiles. Then just set those up as colliders? Hmm, this whole thing isn’t as easy I was expecting. . . I’m going to have to spend more time thinking about the tileset(s).
After getting frustrated I took a step back. Sometimes, you have to take a break to really help figure things out. And it worked. When I woke up this morning another concept had occurred to me, slopes. Obviously, you had to be able to create irregularly shaped colliders. So I pursued that line of thought and found what I needed!
Custom Physics Shape
Custom Physic Shape is the answer. I have to go into the sprite editor and create custom physic shapes around the areas I want the collide. It really was a simple answer, and one I had looked at before but just couldn’t quite figure out. Now I know and I can get my tileset up and working!
One thing that does occur to me though is colliders that still allow pass-through. Lemme explain what I mean . . . like a platform you can stand on, but if you hold down and jump you can fall through, or just jump up through. I will have to come up with a good solution for that, although at the moment I don’t need it.
Not Quite Right
After going through the mind-numbing process of adding collision to that tileset (well, not all of it, but the important parts) I’ve decided it really won’t do what I want. I think. . . I mean, I can use it, and I think I will for the time being, but I feel like I need something more traditional. Especially if I’m going to be procedurally generating levels.
After a few days break, and a lot of thinking, I’m back. I spent time thinking about making a different game instead, something simple, something completely different, something less complicated. But instead, I’ve just picked up where I left off. With a simple tile palette, a ninja with animations that don’t do anything and can’t move, and that’s it.
So I jumped in and worked on the next hurdle, animations! Wouldn’t you know it, it’s so much easier than I expected. Not just that, but I added horizontal movement to the ninja too! So far so good! I really feel like I’m going to have to do more with the animations and such. But check out what I’ve done so far!
As you can see, the walking animation only plays while the ninja is walking! It really wasn’t as hard as I thought it would be, but, as seems to happen a lot, I’ve learned new things! Next up is jumping!
Ugh, jumping isn’t as easy as I was hoping. Not sure what I’ve done, but I cannot for the life of me making it work. I’m going to be beating my head against a wall for a while until I can get this script figured out.
With a little help from Brackys’ character controller script I was able to get it working, sort of. I’m not done working on it yet, but movement and jumping work, mostly. I still need to play with animations and fix it so you can only jump once. Or maybe I can find a way to only allow a variable number of jumps, depending on other things . . . like upgrades!
So far so good, expanding on my character movement script. It seems that for everything I do I run into some kind of problem though. A lot of the issues I’m having are at least partially to do with the tilemap I’m using. I’m really beginning to think that I’ll need something totally different. Or at the very least, do my tilemap in a different way. Check out my character movement now!
And there we have it! A simple, yet complex movement control script is born. I’m sure there’s a lot of things I could do better, and I’m sure my code looks horrendous. But so far it works and I have a better understanding of how all this stuff works!