Hi everyone! Welcome back to another blog where I document the things I learned in web development. I do this because it helps retain the information and concepts as it is some sort of an active recall.
On days 39-41, I built a platform game (a type of game like super mario or geometry dash), a dice game, and solved 4 leetcode challenges which are:
Find The Maximum Achievable Number – in which you are given 2 integers and must return the maximum achievable number after applying the operation at a certain amount of times.
Build Array From Permutation – where you are given an array1 and must build a new array2 of the same length where the elements must meet a certain criteria of the array1.
Permutation Difference between Two Strings – in which you are given 2 strings and must get the index of similar letters and get their absolute differences then get their sum.
Final Value of Variable After Performing Operations – where you are given an array of strings which specify if you are going to increment or decrement the output.
In the platformer game, you must pass through all 3 checkpoints and finish the game by getting to the end. The program is pretty straightforward and can be used as a template for future platform game projects.
While building, I learned more about class keywords and objects. I also learned how to design and organize game elements using APIs to be efficient and gain insights into problem-solving and code reusability.
In utilizing the class keyword, I was able to set the base position, velocity, and size of the main character.
I also learned a simple syntax to check if every element in the array is truthy (e.g .every((rule) => rule)
) while this syntax (e.g. .every((rule) => !rule)
) to check if every element in the array is falsy.
Working with a bunch of classes in the platformer game project, some of the code made sense to me like class keywords and constructor instances. But honestly, if you’d ask me to re-code this project by myself, I would not have been able to do it. In my current skill level, I’ll probably need some template or a guide before I start doing this solo.
Moving on, in this dice game, you are given 6 rounds, for each round, you can roll the dice 3 times, for each roll, there is a random chance of activating certain radio buttons that gives you a score based on the combination of numbers you rolled on your dice. At the end of the 6th round, your scores will be totalled and that’s game. You can use this program to play with someone and whoever gathers a higher score, wins.
While building, I learned how to manage game state, implement game logic for rolling dice, keeping score, and applying rules for various combinations.
This project covers concepts such as event handling, array manipulation, conditional logic, and updating the user interface dynamically based on game state.
Anyways, that’s all for now, more updates in my next blog! See you there!
Discover more from Coursity
Subscribe to get the latest posts sent to your email.