-
Make Web Apps
Once you're familiar with the API, you can check out the example authentication code and full demo app.
-
Make iOS Apps
Download our iOS SDK and then read our extensive authentication tutorial to get up and running.
-
Make Android Apps
Think iPhones are for suckers? It's ok, we have an Android SDK too.
Latest from the Blog
Building Glitch Run in iOS
Glitch Run
In previous blog posts, we’ve seen how to perform authentication with Glitch in iOS and how to animate Glitch Avatars. With just those two things under our belt, we can starting doing some really interesting things – and what better place to start than building a game. In this post, we’ll see how we can take a basic game concept, turn it into a working app, and then imbue it with a little Glitch magic to give it that little extra something.
The Concept
The first step in building a game – and, it must be said, one of the trickier parts – is coming up with a great idea. No doubt you’ve got many great ideas of your own, but to keep this post to a manageable size, we’re going to keep things pretty simple. You’ve probably seen a number of games along the lines of Canabalt or the The Impossible Game, where you play a character running through a world populated by obstacles that you have to jump over. Controls are minimal – in fact there’s only one action to remember – you tap on the screen to jump. The gameplay is very simple, and is a perfect choice for our example app.
Avatar Animations in iOS
If you take a brief look at the Glitch API, you’ll see that it’s very easy to get a PNG image of your player’s avatar. The URL to the image is returned by a call to players.info, and if you want different sized versions, you can find those within players.fullInfo.
players.info:
"avatar_url" : "http:\/\/c2.glitch.bz\/avatars\/2011-10-09\/519a4838c399f998f3a425e8ae7ccea4_1318173267_172.png"
players.fullInfo:
"avatar" : {
"172" : "http:\/\/c2.glitch.bz\/avatars\/2011-10-09\/519a4838c399f998f3a425e8ae7ccea4_1318173267_172.png",
"100" : "http:\/\/c2.glitch.bz\/avatars\/2011-10-09\/519a4838c399f998f3a425e8ae7ccea4_1318173267_100.png",
"50" : "http:\/\/c2.glitch.bz\/avatars\/2011-10-09\/519a4838c399f998f3a425e8ae7ccea4_1318173267_50.png"
}
Static images are nice, but what you’re after is a fully animated character, just like in Glitch. One that walks and runs, climbs and jumps; one that falls asleep; one that looks bored and scratches his butt from time to time. All of that is possible with players.getAnimations. The iOS SDK makes the call to players.getAnimations a piece of cake. In this article we’ll take a closer look at just how we do that and make some sense out of the response.
Animating your avatar works just like watching a film at the cinema – static images are shown in rapid succession, giving the illusion of movement. With Glitch avatars, these images are designed to be shown at thirty images per second and they’re bundled together into a set of spritesheets. A typical spritesheet consists of a set of individual frames from an animation, all stitched together into one big image – something like this:
Getting Started with the Glitch AS3 SDK
Note: Guest author Bradley Adams is the creator of the Glitch AS3 SDK.
It’s easy to start interacting with the Glitch API in your Flash + AS3 apps.
To start, you’ll need to understand Glitch authentication. Using Glitch’s authentication system, you will need to get an access token (using the proper scope) for the user currently using your app. This access token is passed into your app through FlashVars or through other means – possibly an ExternalInterface callback, but this is up to you.
Glitch Run Port to XNA: Part 2
Part 2 – Working in XNA
We covered how to call the API in the last tutorial, but we stopped at the point of actually doing something with the response. In this post, I’ll show how to use that data to load and display an animated Glitch avatar.
For your viewing pleasure, here are some common datatypes and classes in XNA:
Vector2 Structure – 2d location
Rectangle Structure – 2d rectangle
SpriteBatch Class – used to draw textures and text to the screen
Texture2D Class – holds Texture(image) info.
At the end of the previous tutorial, I grabbed the animation data from the API, but had not utilized it. I handed it to a function called On_AnimationDataLoaded. This function pulls all of the spritesheet information, packaging it into an easy to access object.
Dictionary Sheets = responseDict["sheets"] as Dictionary;
I then loop over all of the spritesheets returned and create a nice little object to hold them all.
Developer Meetup October
To everyone that made it out to our first Glitch Developer Meetup, we extend a giant “Thank you!” It was awesome meeting all of you. For those of you that couldn’t make it, or live outside our area, here is a recap of everything that went on.
Tiny Speck’s Cal Henderson gave a presentation that covered the evolution of game APIs, explained the current state of the Glitch API, and showcased some of the existing Glitch API creations.
