Boulder Blaster - First iteration
Today I can present to you what I would like to call the first iteration of my game concept. You can check it out on CodePen. Use left and right arrow keys to move the blue player block, up and down arrow keys to shoot and press the R key to restart .
It is not a complete game, but I think it shows that I have a concept that could be made into something. I feel confident that I have a foundation to build upon.
Ideas for improvements of game play.
While playing the “game” I have conceive of some improvements that I would like to add next.
- Auto-explode a full line of boulders. Like in Tetris but only for the bottom row.
- Add a background grid. Should make it easier to plan moves and see where boulders will end up.
- Make new boulder placement less random. New boulders should be more likely to show up where there is less boulders.
- Some kind of intro/setup in the beginning.
- Red blinking background / marker for columns of boulders that gets too tall.
- Game over screen / message for when boulders reach height limit or player block hits a boulder.
Code review
Currently it is just a bunch of functions and that is not how I like to structure code. I prefer to compartmentalize everything into object and let each function have a little responsibility as possible. As it look right now it is hard to tell where new improvements/features should be added. So I plan on doing a lot of refactoring.
I blame the current structure on me being new to JavaScript. I simply done what was easiest to do when starting out and experimenting with something new. I am looking into how to structure the code better.
At least I managed to hide the functions inside an object so they aren’t in the global namespace.
What’s next?
Besides implement the above mentioned improvements, I would like to add unit and integration tests. I feel I need to get that in place first before I start adding more features. Writing tests will force me to turn the current code into something better and more beautiful (yes, code can be beautiful). As it is now, it would be hard to add to it and be sure I haven’t messed something up in the process.
Visually, I also would like to work on some kind of border/console around the game play area. A place to put instructions and a score counter in future iteration.