16 Mar 2020

Rotation Puzzle Game

My first JS project after finishing my Udemy Course! I made this simple rotation puzzle game to contribute to one of HomeTeam GameDev's projects.


Click on the rotation buttons to bring colored pieces to the correct slot.

Project Update Log


03 April 2020. There's a lot of refactoring I can still do with the code, but I'm so happy to be able to start and finish the core gameplay today. Tomorrow I'll work on the winning condition and screen, and maybe a new level or two (or a puzzle randomizer?).

On a side note though, I'm really glad HomeTeam GameDev members are encouraged to use their own art. Normally, I would have just lifted images off Google and tweaked them a little, but that little rule forced me to be creative. Arriving to this final look took an embarrassingly long time, but I don't think the game would look as sleek as it does now if I'd just lifted stuff off the net. I have also gained an entirely new appreciation for how easy it is to draw shapes in MS Paint, haha!


04 April 2020. I finished the winning condition and screen today. "You Win!" appears below the grid when the puzzle is completed, and there's even a counter for how many puzzles you've finished. The checker was relatively easy to code since the puzzle grid and the moving objects are in separate arrays but use the same constants (1, 2, and 3 for Cross, Triangle and Circle)-- I just had to add a for loop that checks both arrays contain the same set of numbers to declare a win.

I also added a randomizer for multiple playthroughs. This took me the better half of the day as my first plan was to make an array for the placements of the objects, randomize its contents with unique numbers, then place the objects according to the array...it was a real mess before I realized I can just shuffle my existing arrays. I used the Fisher-Yates algorithm, and got the code (and explanation for it) from this article by Nitin Panel.


06 April 2020. Chris included my puzzle in this week's update video, and since his project is open to both Apollo and Outpost groups, I got to see some Apollo members' reactions. A lot of them liked it, and I'm embarrassed to admit that I watched that part more than a few times. Again, there's still a lot of refactoring that I can do with the code, and someday I might return to this game, but for now it's working alright so I'll leave it as is and work on a new project.