I’ve had Codea for a whle, but I was diverted by my day job. I’m now planning to prototype games using Codea on the way to and from my day job (1.5 hours on the train!) So I’d like to use some techniques I’m used to in dev environments I’ve previously used - to make transferring the code simpler.
Does Codea support anything similar to the notion of Spritemaps to implement simple sprite animation? A spritemap being a group of tiled images in a grid that one may load and display periodically? I’ve done a bit of Flash game dev, and we can do something like (this is using the FlashPunk library):
public class Player extends Entity
{
[Embed(source = 'assets/spritemapasset.png')] private const PLAYER:Class; //the PNG contains many sub images
public var playerSprite: Spritemap = new Spritemap(PLAYER, 32, 32); //width/height
//constructor
public function Player()
{
playerSprite.add("standing", [0, 1, 2, 3, 4, 5], 20, true); //sequence for standing
playerSprite.add("moving", [6, 7, 8, 9, 10, 11], 20, true); //sequence for moving
graphic = playerSprite; //assign graphic to entity
}
}
Al lot of that is down to the library, I know. But the Spritemap is actually the main point. Later on we can call this in the “update” method:
playerSprite.play("moving", false); //render next moving frame, false means "don't restart loop here"
Which renders the next frame in the loop (or flips back to the start.) It also does stuff like having a “flipped” property that indicates that the images should be flipped on the X axis (so one can have just the player facing right, then use flip to reverse the image.)
I guess this can all be done in Codes with plain code, but was wondering if anyone had this working already? I specifically want to use a tilemap style interface because it simplifies the assets and will make things more portable for me.