First Attempt at Unity 2D
It's always been a child hood dream of mine to create my own video game. I feel like that's a pretty common dream for kids growing up when I was. They were the hot new thing. I played video games for hours and I always wanted to create my own. I finally sat down to do it this weekend.
It's always been a child hood dream of mine to create my own video game. I feel like that's a pretty common dream for kids growing up when I was. They were the hot new thing. They were becoming more and more advanced, and the competition for the best system was exploding. You had Nintendo, Microsoft, Sony, Sega, and more all trying to be the dominant console. I played video games for hours and I always wanted to create my own. I finally sat down to do it this weekend.
So I got the framework done for my game, and it took me way longer than I feel like it should. I've never created a game before, and the video training I was using was for a 3D game. I followed that tutorial and then took what I learned there to create this 2D game. It's nothing special. Touch bad things and die. Get to the end and grab the treasure and you go to the next level. It has a built in level system which can load levels including the menu.
So the 3D video tutorial that I was watching didn't really do anything with assets. It just did 3D objects and you used those. So the player was a blue cube, enemies were the red cube, and the yellow cubes were the coins. Taking on this project I decided that I wanted to include actual assets into the game. So this way a huge task for someone like me. I can't draw, and I can't animation. I have no artistic ability at all. So I looked to the Unity Store, and there are some very kind people out there. They actually have free to use assets for you to play around with. I don't ever plan on launching this game, so I'm not sure on the creatives rights etc so if you are going to launch the game do that research!
So once you get sprites in the game and you get them running around you instantly realize that hey they don't have animations, and since I have no idea what I'm doing I couldn't figure out how to animate something. I was in luck though because that kind person who had free assets already built some animations! I just needed to splice them! So that's when I found the channel of Gary Thomas. I highly recommend watching his tutorial if you'e stuck on animating. It's a bit out of date but still accurate, you shouldn't have any problems.
The actual coding part wasn't that hard either. Since Unity is so massive lots of people are working on it, and just like me they have no idea what they are doing. So people all over the world are already posting giving them advice and useful information on what I actually needed! It was already done I didn't even have to ask!
Above is some of the code that I was stuck on for hours! Trying to figure out how to have my little dude check to see if he is on the ground or not. Without this he can just jump forever and never have to touch the ground. So he could avoid all the objects and just continue on. I'm not saying this is the correct way to do it, it is just the way I finally managed to get it to work. I think ray casting is better way to do this to be honest, but I couldn't figure it out.
If you get stuck just keep working at it! I was frustrated on multiple occasions because it was a huge pain in the ass for me to get this working. I was constantly stuck, but now that I have the framework done I feel like I am on top of the world. I know a lot more than I did before, and I started becoming comfortable in Unity. I am far off from an expert, but I can actually make my own game now!