{"author_name":"ripter","cat":"LD #25","comments":[],"epoch":1355368380,"likes":1,"metadata":{"p_key":"50581","p_author":"ripter","p_authorkey":"3640","p_urlkey":"86274","p_title":"Zwoptex and L\u00f6ve2D","p_cat":"LD #25","p_event":"LD25","p_time":"1355368380","p_likes":"1","p_comments":"0","p_status":"UPD5","us_key":"3640","us_name":"ripter","us_username":"ripter","event_start":"1355443200","event_key":"14","event_name":"LD25"},"text":"<p>I created a Zwoptex template that lets you export spritesheets into a format you can use with L\u00f6ve2D.<\/p>\n <p>You can find it <a href=\"https:\/\/gist.github.com\/4274146\">here.<\/a><\/p>\n <p>Include the spriteSheet library:<br \/>\n <code>SpriteSheet = require('SpriteSheet')<\/code><\/p>\n <p>then load any sheets created in Zwoptex using the template with:<\/p>\n <p><code>sheet = SpriteSheet:new('sprites')<\/code><\/p>\n <p>Draw takes the name of a sprite (defined in Zwoptex) and the same parameters as love.graphics.draw<br \/>\n <code>sheet:draw(name, x, y, r, sx, sy, ox, oy, kx, ky )<\/code><\/p>\n <p><strong>Manual method<\/strong><br \/>\n You can ignore the helper object and just load the spritesheet manually<\/p>\n <p>You just load the spritesheet with<\/p>\n <p><code>local spriteSheet = require('sheet')<\/code><\/p>\n <p>and then draw with<\/p>\n <p><code>love.graphics.drawq( spriteSheet.image, spriteSheet.frames.green_ball.quad, 100, 300 )<\/code><\/p>\n <p>I&#8217;m probably going to try my first metatable stuff and create a spritesheet object that makes it easer to draw the sprites.<\/p>","time":"December 12th, 2012 10:13 pm","title":"Zwoptex and L\u00f6ve2D"}