Topics:
apps
css
dashboard
games
javascript
mobile
node
php
tehcl
textmate
tools
video
webgl

Backbone.js Super Syntax Sugar

published:
2014.04.19
topics:
javascript

The MVC / MV* library Backbone.js has an extendable class-like system of objects. However, in their official documentation, the only mention they make to calling a parent / super method of a Collection, View, or Model that you've extended is via the prototype chain. From their example:

var Note = Backbone.Model.extend({
    set: function (attributes, options) {
        Backbone.Model.prototype.set.apply(this, arguments);
        // other stuff ...
    }
});

What they didn't document is that they assign a property __super__ to an object's constructor that is equal to the parent's prototype. So you can actually do this instead:

var Note = Backbone.Model.extend({
    set: function (attributes, options) {
        this.constructor.__super__.set.apply(this, arguments);
        // other stuff ...
    }
});

Now we don't need a specific named reference to our parent, which is very nice. I personally like to go a step further and create my own base Model/View/whatever that adds a tiny bit more syntax sugar for us:

var BaseModel = Backbone.Model.extend({
    constructor: function () {
        this._super = this.constructor.__super__;
        Backbone.Model.apply(this, arguments);
    } // constructor()
});

var Note = BaseModel.extend({
    set: function (attributes, options) {
        this._super.set.apply(this, arguments);
        // other stuff ...
    }
});

It is possible to take this even further where you automatically wrap each method in a closure that redefines this._super to actually be the parent method directly so you can just do this._super.apply(this, arguments); inside of any method. I do think that's neat, and several of the JavaScript libraries that use this kind of extends pattern for JavaScript objects do actually do that. But I'm personally content with my above solution in the context of Backbone.


Eye Cycle - Global Game Jam 2014

published:
2014.01.29
topics:
games
javascript
webgl

I made Eye Cycle in 48 hours for the 2014 Global Game Jam. Eye Cycle is a 2-player local multiplayer lightcycle game, but played in the reflection of a giant eyeball. Music and sound by Dan Knoflicek.

Gameplay

Rules are like other lightcycle/Tron or snake type games: don't run into the colored line left by your opponent, and don't run into the edges of the game field. Be careful about lines you can't see that are blending into the pupil or iris!

Controls

Player 1 = arrow keys or gamepad 1 d-pad
Player 2 = WASD keys or gamepad 2 d-pad
Restart = space key or start button on gamepads

Players on gamepads can also control the eyeball movement with the right analog stick!

Eye Cycle title.

Play Eye Cycle with a friend now!

Also try playing reverse mode where the lines you can't see won't hurt you -- in this mode, you only have to worry about the lines you can see!


Global Game Jam 2014 Redux

published:
2014.01.27
topics:
games

Global Game Jam 2014 was this weekend. I jammed with everybody at the IGDA-TC location. This year's GGJ had people participating at 485 locations in 73 countries. I think there were close to 80 people at our location, and several of them stayed on-site for the entire 48 hours. I think one person stayed there and stayed awake for the entire 48 hours. No, it was definitely not me. There are twelve of our games on the website, but I know many other games and prototypes were worked on by the attendees. I ended up making the game Eye Cycle.

Jam Memoir

This year's theme was the sentence, "We don't see things as they are, we see them as we are." I was pretty stumped in terms of game ideas from that theme, although I will say it left me pretty deep in thought about the nature of games themselves. Surely, the way we perceive other peoples' games often says more about ourselves than those games. And definitely the games we make say something personal about ourselves. The best games are maybe the most personally meaningful... even if that meaning isn't explicit to the player.

After the theme was announced, GGJ kicked off like it always does with a group brainstorm where people share their game ideas. This has always been one of my favorite parts of GGJ, because I love to see everybody's creativity and riff off the ideas that are shared.


</2013> <2014>

published:
2014.01.11

Photos from 2013.

Wow! What a year! I marked the second year anniversary of my company Zachstronaut LLC. Since starting my own company to work for myself, the challenge has always been finding meaningful work and balancing consulting/business partnerships with creative/artistic interests. These two things are not mutually exclusive, and they overlapped wonderfully in 2013!

December/January are the time of ennui and self-reflection. "Did I accomplish anything this year?" I wonder to myself. How did those New Year's Resolutions turn out? Well, read on, because that's what this post is all about...


The Legend of Equip > Pants

published:
2013.11.27
topics:
apps
games
javascript
mobile
The Legend of Equip Pants.

I'm very pleased to announce my first commercial video game release! The Legend of Equip > Pants is a pantsventure RPG taking place in an alternate universe where an old man in a cave would hand Link some wooden underwear instead of a sword (if there were old men living in caves). The game unveils itself as a series of brief episodes, because who has the energy to stay invested in 40 hour long RPG plots anymore? I sure don't.

Currently available for free for iPhone, iPad, and iPod touch. Coming soon to Windows/Linux/Mac on the Chrome Web Store. GoGetYourPants.com

Please try it out! Episodes 1 and 2 are now playing.

The Legend of Equip Pants