Monday 25 February 2013

Animated Mario sprite with game{closure} + coffeescript

Just a quick one; an animated sprite in game{closure} using coffee script:

image directory structure:
├── resources
│   └── images
│       └── mario
│           ├── mario-run-0001.png
│           ├── mario-run-0002.png
│           └── mario-run-0003.png

Sunday 17 February 2013

More coffeescript + game{clojure} ...

Today I ported game{closure}'s animated trail example to coffeescript.

For anyone wondering, the work flow I'm using is:

Create a new game project:
$ cd ~/devkit/projects/
$ basil init <game-name>


Create a coffeescript directory:
$ mkdir ~/devkit/projects/<game-name>/coffee

Watch and auto-compile coffeescript to js and copy to the projects /src directory
$ cd ~/devkit/projects/<game-name>/coffee 
$ coffee --watch --compile --output ../src/ .

Run sdk web frontend
$ basil serve

Start hacking at your application.
$ emacs ~/devkit/projects/<game-name>/coffee/Application.coffee

And here is the code:

Saturday 16 February 2013

GameClosure & CoffeeScript

Yesterday a colleague pointed me a very interesting game engine called GameClosure that can compile Javascript and HTML down to native code for mobile devices.



Never wanting to touch Javascript after having discovered the wonders of CoffeeScript I took a quick look at how to get a hello-world example working with CoffeeScript & GameClojure... here's the code:

A couple of points of note here are:
  • exports is backtick-escaped so as to render directly to javascript as the engine requires exports to have global scope.
  • CoffeeScript's implementation of inheritance replaces GameClosures 'Class(<super class>, func...' inheritance helper function (and is much nicer IMO) as seen in their javascript implementation of hello-world

Hopefully it's this easy with, non-trivial, GameClosure applications.