Dodging astroids in bootcamp
So ends week two of tech bootcamp. I am so looking forward to having a day off tomorrow …mostly to study! We’ve done three “sprints” this week (and a boatload of other things as well). The sprint we did on Monday and Tuesday (involving a lot of jQuery and object prototype inheritance) seems like it was weeks ago. The second sprint was all about callbacks and promises, promises, promises. Yesterday and today, we were tasked with using D3.js to build a cool (but seriously a pain in the tachat to build) ‘video’ game that is not too dissimilar from the old Astroids arcade game. We had to build it completely from scratch.
My partner and I managed to get first circles, that we then replaced with astroid images, moving in a random pattern. We got the player object (we wanted it to be a space cat image but ran out of time, so it was just a circle that changed colour depending on whether it was at the start position (white) before the game began, turning yellow once the player started moving it with the mouse, and red if it couldn’t avoid the zipping astroids and got blasted). We got the ‘highest score’ and ‘current game score’ to work — but after 8 solid hours, we could not find and fix what turned out to be a single line of mangled and partially missing code that kept the count of the number of collisions and reported them to them player. More specifically, the counter was all good, we just couldn’t get the program to recognize that a collision had happened. Gah.
Even with that minor (ok, so seriously major) flaw, the game we created is pretty darn cool, if I do say so myself. We didn’t do too shabbily, given that we’d never heard of this D3 library thing* (see below for what it is) or worked with SVGs before, were told the documentation is ….sparse …and that we were going to need to use it in a way it wasn’t designed to be used: Go forth and read, Google, hack, cry, and pull your hair out.
Check mark for all of the above!