zacharylew.is

Professional by day, indie by night.

Tanlines in the Shape of a MacBook Air

I hate the beach.

There. I said it. Go fire up your torches, raise up your pitchforks, brandish your SPF 70 and batter down the door of my sandcastle, for I have writ the inconceivable and must be consumed by fire.

Overly dramatic? Perhaps; however, it’s a far cry more tame than the courtesies my friends and family extend whenever I choose to sit inside and work (or, as they know it, “play on the computer”) instead of going down to the beach and sitting in the sun. I can’t help it: I’ve stopped liking the beach. I can’t seem to enjoy wrenching myself away from the work that I love and want to do to sit in an uncomfortable, aluminum-plastic excuse for a lounge, cover myself in oily, glistening, ineffective protection and get sand on, and in, absolutely everything. I’m not bashing it: The beach just isn’t my thing.

With that said, the crux of this article rests on the following fact: I love vacationing on the beach.

I can hear the cacophony of a million eyebrows furrowing in unison. Settle down, kids. I’m about to explain myself. Using words.

The the Game Studio Business Card: GDC 2012 Update

My girlfriend and I are headed to San Francisco next month to attend the Game Developer’s Conference, and I want us to make as big an impact as we can, short of running naked through Yerba Buena park. Last year, I took some screenshots of old (and non-existant) games that I developed under my game studio, The Game Studio, put them on some Moo cards, and called it a day. This year, we’re going for something completely different.

// Snipp’d: getOrdinalOf

Yesterday, I had to write a function to take a number and get an ordinal number from it (turn “14” into “14th”, for example). It got me messing with the way ActionScript parses in-line conditionals. Then, things just got goofy.

getOrdinalOf
1
2
3
4
5
6
7
8
9
10
11
/**
 * Get the ordinal string ("st", "nd", "rd" or "th") of a given number.
 * @param    value the number whose ordinal string is to be returned
 * @return   The ordinal string of value.
 */
public static function getOrdinalOf(value:Number):String
{
  var n1:Number = Math.abs(Math.floor(value));
  var n2:Number = n1 % 10;
  return (n1 % 100 < 21 && n1 % 100 > 4) ? "th" : (n2 < 4) ? (n2 < 3) ? (n2 < 2) ? (n2 < 1) ? "th" : "st" : "nd" : "rd" : "th";
}

I wrote this in ActionScript 2. It should work in ActionScript 3 unmodified, but you can eliminate the calls to the Math library if you change the type of value from a Number to a uint. If you might have negative numbers, you can use an int and keep the Math.abs() call.

I Would Like to Be Your Mentor.

I would like everyone to know that I participating in the /mentoring movement that was started by Diana Kimball. The basic gist of the movement is that I provide a link to a page (a “/mentoring” page, if you will) that describes my life experiences and encourages people who would like to learn from me to do so. I promise to respond to all of you folks, so feel free to read over my experiences and flood my inbox.

Hello World!

There’s something about getting into a pair of comfortable pajamas, throwing on a t-shirt and a hoodie, propping my feet up on the coffee table, turning on the television and working on some random bits of code—a game prototype that’s rushing toward design, learning AIR by writing development tools, or messing around with some new-fangled web technology that all the cool hackers are talking about—that just puts me in a good mood and really improves my creativity. It’s those nights when I just know that I’ll have completely squashed these bugs with just one more build. Of course, it rarely ever happens. I don’t mind, because I know that it’ll take just one more build.

I am a developer. I make video games. It’s a pleasure to meet you.