If you, like me, have been using Zwoptex to create your spritesheets for Starling or Sparrow, you might have noticed a distinct lack of trim support. That is, Zwoptex claims to be trimming your files, but the resulting XML does not include any such trim data. Use the following file to fix this pesky problem:
Game Development
Since Cocos2d iPhone’s OpenGL is only capable of repeating textures that have dimensions which are a power of two, I’ve put together a quick-and-dirty algorithm to tile arbitrarily-sized sprites to arbitrary sizes. TiledSprite takes a source sprite with a texture from a file or a subtexture from an atlas, and clips and/or tiles to fit the requested width and height. The source code is available on GitHub as a Gist, just copy-paste it, download it, or clone the repo and grab the .h and .m for use in your project.
Here’s something you’re likely to have run across: the player character is in the center of the screen, and you want it to move in the cardinal direction you click, relative to its position—clicking above it moves north, below south, to the right east, and to the left west.
I’ve implemented this control scheme in my current project, settling on the following technique after a less-than-elegant implementation relying heavily on if-elses:
MDA: A Formal Approach to Game Design and Game Research is a paper borne out of talks and workshops given by its writers, Robin Hunicke, Marc LeBlanc, and Robert Zubek, with the aim to formalize the understanding of games by splitting them into three parts: Mechanics, Dynamics, and Aesthetics.
Normally, in regaining momentum for a project, I’ll pick it back up and work on small-ticket items just to get into the groove again, then work my way into the larger items. Though this time I have done the opposite, I finally have a handle on one of the larger features for version 0.4: custom keymapping.