{"id":39,"date":"2010-11-25T21:39:14","date_gmt":"2010-11-25T20:39:14","guid":{"rendered":"http:\/\/gendev.spritesmind.net\/wip\/?p=39"},"modified":"2021-06-29T22:37:37","modified_gmt":"2021-06-29T21:37:37","slug":"animlib-v3-with-behavior","status":"publish","type":"post","link":"http:\/\/gendev.spritesmind.net\/wip\/2010\/11\/animlib-v3-with-behavior\/","title":{"rendered":"AnimLib -v3, with behavior"},"content":{"rendered":"<p>I finally finished my animated sprite library, with behavior.<br \/>\nFelicia now jumps <a href=\"http:\/\/gendev.spritesmind.net\/wip\/wp-content\/uploads\/2010\/11\/animLib-v3.zip\">like a frog<\/a> using this code<\/p>\n<pre class=\"brush:cpp\">void Felicia_update( struct AnimatedSprite *felicia )\r\n{\r\n        if (felicia-&gt;curFrame&lt;2)        return;\r\n        if (felicia-&gt;curFrame&gt;6)        return;\r\n\r\n        felicia-&gt;x++;\r\n        felicia-&gt;x %= 320;\r\n}\r\n\r\nint main( )\r\n{\r\n        struct AnimatedSprite *animFelicia;\r\n\r\n        Anim_Init();\r\n        animFelicia = Anim_New(FELICIA_ANIM, &amp;felicia, 1, 10, 70, PAL1 );\r\n        Anim_LoadPal(animFelicia);\r\n        Anim_SetBehavior(animFelicia, &amp;Felicia_update);\r\n\r\n        while(1) { Anim_Update(); }\r\n}\r\n<\/pre>\n<p>Note this demo is now using the last version of Stef&#8217;s <a href=\"http:\/\/code.google.com\/p\/sgdk\/\">GenDevKit<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I finally finished my animated sprite library, with behavior. Felicia now jumps like a frog using this code void Felicia_update( struct AnimatedSprite *felicia ) { if (felicia-&gt;curFrame&lt;2) return; if (felicia-&gt;curFrame&gt;6) return; felicia-&gt;x++; felicia-&gt;x %= 320; } int main( ) { struct AnimatedSprite *animFelicia; Anim_Init(); animFelicia = Anim_New(FELICIA_ANIM, &amp;felicia, 1, 10, 70, PAL1 ); Anim_LoadPal(animFelicia); Anim_SetBehavior(animFelicia, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/gendev.spritesmind.net\/wip\/wp-json\/wp\/v2\/posts\/39"}],"collection":[{"href":"http:\/\/gendev.spritesmind.net\/wip\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gendev.spritesmind.net\/wip\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gendev.spritesmind.net\/wip\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/gendev.spritesmind.net\/wip\/wp-json\/wp\/v2\/comments?post=39"}],"version-history":[{"count":7,"href":"http:\/\/gendev.spritesmind.net\/wip\/wp-json\/wp\/v2\/posts\/39\/revisions"}],"predecessor-version":[{"id":227,"href":"http:\/\/gendev.spritesmind.net\/wip\/wp-json\/wp\/v2\/posts\/39\/revisions\/227"}],"wp:attachment":[{"href":"http:\/\/gendev.spritesmind.net\/wip\/wp-json\/wp\/v2\/media?parent=39"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gendev.spritesmind.net\/wip\/wp-json\/wp\/v2\/categories?post=39"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gendev.spritesmind.net\/wip\/wp-json\/wp\/v2\/tags?post=39"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}