Friday, 4 May 2018

D8 I fixed some bugs!


View this on my main page


Hey Everyone and Welcome to Day 8!


Today's Goal!

My main goal for today was to complete the Javascript tutorials and actually be able to assure myself that I could make a website for myself. Beyond this I also wanted to sort out a few bugs that were taking place in my game engine. The bugs were small but very much game breaking and it all hinged upon overlapping. Basically if two different things were overlapping the areas around them were not working properly, this was the case for lights and buildable areas.

The tutorials!

But first let's talk about the tutorials. The final few tutorials were to do with while loops and functions. These were good fun to play with and finished by making a reaction tester. In this a shaped would be displayed in a box and then you would be timed with how quickly you could click on it, at which case it would disappear and then you would have to click on it again. It changed shape, size, position and colour when it disappeared and reappeared as well. To go a little further after the tutorials, I took the reaction tester to the next level and also made a variable to keep track of your best time so you had something to try to beat.
The Reaction Tester

The future of Javascript!

For me, I enjoy Javascript but don't feel like I know enough to fully implement something into my portfolio page beyond what I have. The next tutorial is on JQuery, this should be fun.

Fixing the bugs!

I next moved onto fix some bugs in the game. This started with making sure that buildable area was correctly drawn. What was happening was that when I was building paths, they were setting an area around them to be "true" in an array called buildable area. This was fine until it came to destroying paths. Without a complete search of the area it would have been impossible to determine if the squares should still be buildable or not, because of another paths elsewhere. To solve this I simply made the paths, instead of setting the element in the array to true, increment the value of  it by 1 and then tested if the value was above zero. This meant that as paths were built and destroyed, the buildable area was kept buildable until it wasn't meant to be.

What about the lights?

The lights were a similar problem. When destroying lamp posts, it would reduce the amount of light by the amount it was meant to. The problem came down to, once again how it was stored. The light values were being stored as a value between 1 and 0. The problems arose when the light value of a certain cell should have been more than 1. In this case the code would automatically ignore whatever was above the 1 and just store 1. When destroying lights, removing the correct amount meant setting the value to lower than it should (possibly even darker than a square that never had any light). This was solved by simply moving the check for it going over 1 into the render function and storing the complete number. This way when the light value was above 1, it would remember by how much and remove this before any of the light. Simple!

Tomorrow's Goals

I made my portfolio page quite early into my web development journey, I want to completely redesign and remake it with all the new things I have now learnt. This would probably be at the top of my agenda for things to do tomorrow, maybe I'll redesign it tonight and had a PSD setup ready. Next week is where it all starts properly though. I am going to be using Freelancer to try to find a freelancing job or two for things that are within my skill range. I might even start making a few websites for fake companies that I could use to try my new found skills.

For now though,

Happy Job Hunting,

Matt

P.s. Sorry for the very wordy post!

No comments:

Post a Comment