Why is my code working?? Don’t touch it.
Why is my code working? … Don’t touch it.
I am not a video game person. The last game I (willingly) played was Mario Kart on Nintendo 64 in elementary school. I think I missed the boat on shedding tears over older siblings unplugging your console right at the precipice of greatness.
However, what I did discover this week was how f*cking awesome games are for learning how to code.
An abridged tour of my inner-monologue this week:
- Why can’t I see anything on the page?
- WTF do you mean DOMDisplay isn’t defined?? It’s literally right. there.
- Why is my character moving like there’s a rocket under its ass??
- I swear I didn’t change a thing. Why is it working now?? Don’t touch it, Kamila. Don’t touch it.
This week I struggled with feeling okay with not knowing everything. My platform game was loosely built following a tutorial. A lot of the code was there along with ample explanation, but I did not feel comfortable with the extent to which I knew that I would not have been able to implement this game on my own.
As the week progressed, I took a step back and realized that that is precisely why the tutorial exists. If everyone following the tutorial already knew how to build the damn thing, it wouldn’t exist. Take a breath.
All said — I understood ~80% of my code, which is 100% more than I understood on Monday. I need to be kind to myself.
Here’s some nuggets that I took away from this week:
- ES6 makes it infinitely easier for me to compartmentalize my thoughts and follow game logic. Being able to see classes with clean method declarations all neatly organized is heaven sent. Even though this tutorial utilized ES5 syntax, I plan on refactoring this project in a few weeks using ES6 to see if I can’t glean a deeper understanding of some of the logic.
- I need to do some more exploration on .appendChild() . It was used heavily throughout the tutorial code, and I want to make sure I have a firm grasp on it.
- Implementing game motion is a ton of trial and error. Hence the aforementioned “why is my character moving like there’s a rocket under its ass???”. It takes a bunch of tries to get characters to move at a logical and smooth pace, while mimicking “gravity” as they fall from platform to platform.