Finishing My First JavaScript Project

Eddie Na
3 min readAug 12, 2022

--

I just have finished my first JavaScript project : 🚀Space shooting game . It’s a web based shooting game using keyboard. It keeps your highest score, and if you type your name and press the post score button, the server stores your score. If you have high enough score to be in top 5 rank, it will show up on the scoreboard too.

đź’» Used Stacks đź’»

Languages

APIs

It looks Like :

screenshot of the game page

After 4 weeks of studying JavaScript, I started this project. As a game lover, I thought that maybe I can enjoy coding more when I code what I can play, which turned out half right. When I started coding, I looked up many youtube videos and many blogs, searching for “JavaScript shooting game code”, hoping that there is some whole code I can copy and paste. Unfortunately, there wasn’t. There were some youtube videos and blogs that I was able to get some idea where I’m going, but they were all different using different logic, api, and different looking as well. So I had to build my own code from scratch, picking up some ideas from them.

First, I got an idea of using canvas api. It was very helpful making my game area actually look like an animation. Then, I built code to make the enemies come down, space ship to move on arrow keys, space bar to shoot bullets, enemies die when bullets hit them, and score goes up. So the game was built! It took me 3 days (I had to make some changes later though.).

Then real problem started. I still didn’t know how to use public api to store and get data. To be exact, I didn’t even know how to use JSON. I tried watching youtube videos, reading many articles and going back to study modules and read again to understand the whole idea of it, for … FIVE DAYS! I realised I couldn’t finish my project in time that I had to talk to my instructor to get a week extended due date. I had to get on it immediately not just reading bunch of words which I still couldn’t understand. It was stressing me out. Then I saw that one of my class mates shared the api he used for his project : JSONbin.io. Still with no idea how to use it, I just copied their guide code and pasted it in my code. I read their guide page, played around with my code. It wasn’t too hard to make it work for my code! I got it working within a few hours then I could move onto refactoring.

I successfully submitted my project, and I got a good feedback from my instructor. My code was working good and I used APIs well. One thing I could do to make it better was more refactoring.

So, what I learned from this? I shouldn’t spend too much time on reading so much trying to understand the concept. If I just moved on and started using guide codes, I could have saved 5 days. Eventually, I did understand the concept of using json and I could use it. It was way more helpful using it and playing around with the code to understand than reading all the texts or watching many explanation videos. Next time, if there is anything I can not fully understand but I have to use it, I will just start from playing around the code.

When I was stuck coding, I felt lonely, tired, stressed out. But I know that it can never beat the feeling when I finally make it work. So I tried to calm down, rested little bit, sometimes even a day, then come back. After the refresh, I felt like I had clearer thoughts and was able to code better.

It was a really helpful journey to get ideas of know hows. Can’t wait to start the next journey, React!

--

--