Tuesday, 1 May 2018

D5: Today was well spent! Plus first look at my upcoming game?


View this on my main page


Starting with some HTML

Day 5 started for me by editing my website to include a blog page (hopefully that is where you are seeing this, if not head there now : Click Here). Also I added my twitter feed to the front page, for now it takes up a lot of the page, but I may change it at some point to be smaller but for now I like it.

Today's Tutorials

I then moved on to more studying and learning how to use JavaScript, I did some of the tutorials but with also having to squeeze in some time for an hour of coding, and gm and then also going to bed at a reasonable time for work tomorrow, only the first part. I learnt the basics though and managed to make some circles on the screen that can disappear when you click them.

The Game

Once I reached a natural ending point (or pausing point I guess) I moved from my PC to my laptop and began to code for my game in Java. I never really knew what I wanted to achieve today but when I sat down I decided it was time to start implementing items that can be build and placed. I knew they had to be restricted to certain areas, so they can only be placed withing a 5x5 square with a path in the middle.
The Complete Game Screen

Making Maps with tiles

The Game at the moment is a 2-D game that has a bunch of tiles. These tiles I've made so they transition almost nicely, I've kinda cheated at the minute in forcing a bit of mud between the different tiles as this means I have something to transition to. I ma at some point make it so the smoothly transition but that is for further down the line, for now there is just a small amount of mud, but  hey! It looks better than just being squares.
The tiles transition with a small amount of mud

Saving, Loading and Paths

The tiles are read from a text file (.til) this has a reference to each tile in the form of a byte, each byte refers to a different tile that is then placed into an array and the game then renders each tile based on which byte is passed. This also goes for the paths. The paths as I said are used as a way for me to restrict where things can be built but also to allow more versatile transitions. Paths do not transition from one to another but do however change which tile is displayed based on what tiles are around it, for example, as can be seen in the picture with the road, if the road piece has a piece to the left, right and below it, it will display a "T-Junction" piece. There are 5 different states each road can  be in and then the can also be rotated as needed as well.
Paths transition with each other, not other tiles

Using Menus to Allow Building

New paths and tiles can be placed using the appropriate menu, this is at the bottom of the screen and has an icon for each different tool it has. There is a demolision tool (The Bulldozer), tile tool (the shovel in a pile of dirt), the path tool (The path) and an item building tool (A spanner is being used a placeholder for now).
The menu is used to select a tool

Today's Work, Items

So we get to today. Today I made items that can be built, well one to be precise, I made a lamp post that can be placed by the side of a road, when placed it looks like the one in the red circle. It does also alert the player whether it can be built or not by tinting red or green (red for no, green for yes). My next task I think is to create a light map and begin to make the street lights actually do a thing, then beyond that I can make a day and night cycle and have them only turn on during the night etc. But that is for another day, for today I am done with coding, I need to go to the gym.


Happy "Spending ages trying to implement one thing and it just doesn't want to work"-ing,

Matt



No comments:

Post a Comment