My First Project: What I learned
Tags: beginners, javascript, webdev, game
Published: 2020-03-03 20:56:13

---
title: My First Project: What I learned
published: true
description: A beginner's first personal project
tags: beginner, JavaScript, web development, game
cover_image: https://res.cloudinary.com/dytmcam8b/image/upload/v1583268803/bennyscreenshot_x0kk8i.jpg
---

There's that awkward time just after you set out learning web development when you go from the exciting 'what will come' of dreaming about a future career of problem solving, up-to-date technology and a decent pay packet to having to put your money where your mouth is and having to do some actual coding.
</br>
Common advice online steers new, self-taught coders towards creating a portfolio of personal projects that can be used to showcase your knowledge and skills to future employers. 4-6 seems to be the sweet spot. With that in mind, I set out to create my own first personal project. 
</br>
I had the initial idea while learning about loops. I thought about how I could try and apply them to a simple concept and, for some reason, I thought about Tamagochi's- the children's digital pets- as an example. The idea of repeated sequences for certain time durations. That's how I came to decide on making my own virtual pet. Taking my pet dog for inspiration, I named him, Benny.
</br>
Naming it was the easy part. Next, I had to think about the features I wanted to include. I knew I wanted it to eat, play and get ill. I also wanted him to die if neglected. For the player, I wanted them to be able to add to his life if they interacted with it via toys or food. I decided I'd give him a life comprised of health, happiness and hunger, each with a level of 4 that would eventually run down to 0 if left unattended. 
</br>
This countdown was achieved by having a function that generated a random number from 1-3 that decided which of the three life areas would have a level deducted every second. To be honest, the actual implication of the timer would prove to be the most difficult part of the build. The timer would variously not stop, or at one point I had 2 timers which were double counting. In the end, it would be a developer across the world from New Zealand who contacted me via Twitter who would unpick my tangled code and let me finish.
</br>
On the part of the player, onclick functions allow them to increase the levels of each of the life areas. These are accompanied by sounds.  The actual sprites I used of Benny and his accessories were purchased for around $10. I'd made a start to try and make my own but I feel it was worth the investment for a more professional look. Especially if I want to use it later in my portfolio.
</br>
I didn't achieve everything I set out to do. I wanted him to sleep after being left idle for so long but the speed of the game was providing enough challenge that he couldn't be left for very long without dying anyhow. There's also issues with the CSS- I'd have liked the submit button to move up when the death message appears but that was beyond my understanding of how to achieve it for now. I may rework the CSS in Bootstrap prior to applying to any real jobs in the future.
</br>
The project took a month of free time to finish, although I certainly wasn't spending all my non-work time on it as I was doing freeCodeCamp, attending a meetup and going on holiday around it.
</br>
I've learned a few things aside from the technical aspects I used to make Benny. I've learned to search better for information and ask clearer questions. This is made easier as your coding vocabulary increases as you're exposed to more and more concepts. I've also learned that Twitter is a great source of both help and also of encouragement. If you're not already using it as a coder, join up to #100DaysOfCode immediately. You won't regret it. 
</br> 
I don't know what project 2 will be yet. I'm moving on to freeCodeCamp's Front End Libraries certification next so it all depends on the possibilities of Bootstrap and React. But I'm enthusiastic because it feels like making a personal project is where the knowledge from any courses meets me- my interests and personality. What a simple purple blob says about me though, is anyone's guess...
</br>