Yearly Archives: 2009

Decision making

Teenage Turtle Mutant Ninjas Ninja Mutant Teenage Turtles Turtle Mutant Teenage Ninjas Teenage Ninja Turtle Mutants Turtle Teenage Ninja Mutants Ninja Turtle Mutant Teenagers Mutant Turtle Ninja Teenagers Ninja Teenage Turtle Mutants Mutant Teenage Ninja Turtles Turtle Mutant Ninja Teenagers Mutant Teenage Turtle Ninjas Teenage Ninja Mutant Turtles Ninja Turtle Teenage Mutants Mutant Ninja Teenage Turtles Teenage Mutant Turtle Ninjas Turtle Ninja Mutant Teenagers Teenage Turtle Ninja Mutants Mutant Turtle Teenage Ninjas Ninja Teenage Mutant Turtles Ninja Mutant Turtle Teenagers Turtle Teenage Mutant Ninjas Mutant Ninja Turtle Teenagers Teenage Mutant Ninja Turtles Turtle Ninja Teenage Mutants

Closures with self-invoking functions

Just a quick note-to-self… I’m a big fan of using self-invoking anonymous functions to keep stuff out of the global namespace, but I forgot that they are also nifty for keeping variables in scope via closures. Here’s the problem… Let’s say with have an array that we’d like to populate with functions. The functions simply […]

Using jQuery on JavaScript objects (Part 1)

Today I was trying to decouple some JavaScript classes in a game prototype I’ve been working on. I didn’t want to get into implementing some kind of interface behaviour, and so I thought about a simple Observer pattern. There are a bunch of solutions around the tubes (and indeed I’ll probably use one of them) […]

Esrever ni sdrocer gniyalp

I’m getting pretty sick of people coming up to me on the street and asking how they can play their records backwards to hear the devil. “I can’t spin it backwards at a constant rate” they cry, “and I get tired after a while. What can be done?!”. It’s upsetting that this problem still plagues […]

Soldier Soldier

Soldier Soldier by Computadors

Game of Life

Conway’s Game of Life is a simple cellular automaton based on a few simple rules. There’s about fifty gabillion implementations of it around. Here’s mine: Game Of Life in Javascript (rendered, of course, on Canvas). I just followed the rules on the Wikipedia entry, so I’m not 100% sure it’s fully “Game Of Life Compliant”, […]

Smoking Canvas

On the way to work today I remembered an old trick to create a “fire” effect: you randomly assign a colour to the pixels on the bottom row of the screen (in the same hue) and for each row above it take the average of the 3 pixels immediately below it, and 1 pixel that […]

Springs with Canvas

Even more Canvas vs Maths fun! This JavaScript demo vaguely emulates some spring physics. There are 10 linked points – each of whose acceleration is determined by the distance to the spring in front of them. A nice curve drawn between each point using the quadraticCurveTo command. And it sure makes some perdy patterns. The […]

3D with HTML5 Canvas: Part 2

Part 2! Unbelievable, my attention span is expanding in my old age… Today we are going to look at building on the 3d starfield of Part 1 by moving from dots to lines! By the end of this tutorial, we’ll have a floating cube demo that we can scale and translate in 3D space. Use […]