w6d1 - A Space Oddysey
Space, the final frontier, where no one can hear you scream. Not even when you’re hurtling at 10 px per second and repeatedly slamming into asteroids, that, for some reason, are perfectly round. And all the same size… And green! But none of that matters, because today we built a fairly full functioned Asteroids game! For a few hours of work, we were definitely excited to have built something that we could actually play with in a browser. We utilized an HTML element called ‘canvas’, which allows you to draw shapes and paths on a virtual canvas. It was a simple tool, but surprisingly flexible. It wasn’t quite able to simulate motion (at least not in any way that we could see), but it was fast and powerful enough that we were able to calc the next move of all objects on the screen and redraw them hundreds of times per second, causing it to render with surprising fluidity. The Chrome debugger came in handy today, and we even spent some time using the breakpoints and step in/out abilities to get access to some of the inner workings of some things we were having trouble with.
We also got another taste of CSS today, with Jonathan delivering another lightning lecture at the end of the day. This one was focused on how to use ‘float’ to create clean layouts. This also included a tidbit about injecting a blank string at the end of your content. If you neglect to do that, the container holding your floats will actually not recognize the fact that the floats are there and essentially ignore them. By injecting this empty content, it forces the container to resize and fit the floated content perfectly. Tomorrow we will be getting into more CSS, in depth this time, so let’s see if any of these points have stuck in my brain!