21 March 2018

Space Creatures

Since January, I have been at Recurse Center. I like to refer to it as a self-directed coding retreat. I’m really loving it. As is seen on this blog, I really enjoy jumping into side projects and building fun things. This space is great for it as it gives me a wonderful environment to work in, and also the added benefit of being around interesting people who are also working on interesting things. It feels part academic, part co-working space, part art studio, and part social experiment.

I can talk more on RC, but I figured today I would share the project I built when I applied. There were many prompts to choose from, and I chose one that asked to implement your own version of Space Invaders. I called it Space Creatures!

After going through the initial application and sharing it, I worked on it for an extra day, because I was having fun piecing it together. I built it from scratch, using no libraries (as the prompt requested limiting usage of other libraries). My favorite parts were the sounds and explosion animations. In trying to get the right easing on my animations, To point out one random part, I had fun resorting to high school math and plotting ideas on the built-in Grapher tool on my Mac:

 _fade_out_exp(frac) {
  // frac - float - 0 to 1
  // exponential fade-out: y = (2 - 2^(1 - 6x)) / 2
  return (2 - Math.pow(2, 1 - 6 * frac)) / 2;
}

Space creatures easing function graph

This was the first project on which I used Prettier. I also went on a fun tangent reading about Symbols and realizing that my initial intuition on how I wanted to use them as enums isn’t exactly what they’re really meant for.

Space Creatures links:

Space Creatures game




Did you find this helpful or fun? paypal.me/mrcoles
comments powered by Disqus

Peter Coles

Peter Coles

is a software engineer living in NYC who is building Superset 💪 and also created GoFullPage 📸
more »

github · soundcloud · @lethys · rss