I'm Coding a Game - Part 6

Every time I look over the lesson or tutorial for this series I tell myself, “This is easy, should take me five minutes.” To my surprise it ends up taking me a week! Oh well, as long as I’m moving forward however slow at times is still progress. This week I worked on camera movement and tiles.
 
Camera and Camera Angles:
 
The first needed to do was resize the room. I made it wider so that the whole scene would not fit onto the monitor. Since I didn’t have a camera following my character, my player could run off screen and it essentially looked like a broken game. So I wrote some code to address that, and assign that code to a camera in GMS2.

Now this game has room to grow… just like the plants I have in my basement… for medicinal purposes.

On the create event, I created a couple variables

The step events is where all the code for the camera.

The coding on the camera is pretty straight forward, but no less useful. The first part with the IF statement states that IF upon character creation(The player) follow it. The second part, is to make the camera move at a certain pace as the player is moving. If the character falls and is accelerates, the the camera will do the same. As the player slows down, so will the camera. Lastly, I wrote two lines of code, that featured the clamp command. Clamp is used to set a max, and a minimal on a variable. I used this to stop the camera moving if the player runs next close to the wall. If I didn’t have the clamp code written in, then the view would stay centered on the player and there would be a lot of wall or dead space on the screen.
 
Tiles:
 
This is where I really sunk a lot of time in to this installment. First let me explain what a tile is and the tile set that I created. So if you noticed the walls in my game looked a rather dull gray.
 
As you can see the walls look bland. Now I could design each individual piece of the wall, but that would take forever. If only there was a way to set a predefined section and place them over the walls. Well, that’s what tiles are. Tiles or tile sets can be thought of as wall paper, or paint, or putting lipstick on a pig. So I looked up on the internet to see if there were any free tile sets, and no there were not. Well there were, but I didn’t trust the sites that they were on. So I went through the grueling process of finding just a section of a wall that was domain free. I found one but I had to alter it…46 times! I had to do this to make the entire tile set. When I finished I had something like this:
 

Once I loaded this into the program I was able to basically paint the walls very quickly. Now, I can map out the entire level in a couple of seconds, rather than spending weeks or months designing every square of wall.

I might want to tweak the tile set a little bit because it comes across as a bit loud. However, it definitely looks a lot better than it did. I’m just trying to get the pieces together, I can fine tune the game later.