I'm trying to make a 2D platformer that uses one spritesheet and spritebatch for all the foreground objects. However, I don't know how best to structure my code around Spritebatches. I have a Lua table that contains tables of quads like this:
Code: Select all
local spritedata = {
player = {
{0,0,8,16},
{8,0,8,16}
},
brick = {
{8,48,8,8}
},
...
}
Code: Select all
player:update(dt)
sprites:set(player.sprite_id, player.quads[player.current_frame],player.x, player.y)
-- would like to have something like updateSprite(GameEntity)
Thanks