
{"id":1139,"date":"2016-06-04T11:00:21","date_gmt":"2016-06-04T11:00:21","guid":{"rendered":"http:\/\/blogs.plymouth.ac.uk\/telmed\/?p=1139"},"modified":"2020-01-03T11:10:31","modified_gmt":"2020-01-03T11:10:31","slug":"icare-making-an-app-thats-easy-to-edit-and-how","status":"publish","type":"post","link":"https:\/\/blogs.plymouth.ac.uk\/digital-education\/icare-making-an-app-thats-easy-to-edit-and-how\/","title":{"rendered":"iCARE &#8211; making an app thats easy to edit, and the workflow involved"},"content":{"rendered":"<p>One of the criteria for this project was to eventually make it open source. Whilst I&#8217;m not sure if this will actually happen, it did make me think more about my code and how best to\u00a0approach the way in which new content gets added or changed. Few things this post will include are:<\/p>\n<ul>\n<li class=\"p1\">How we&#8217;re to enable the app and its contents to be easily editable in future. Such as in the event someone other than myself wants to make changes or if the code for the project was to become open source.<\/li>\n<li class=\"p1\">Show simple it is to make content changes (edits and additions), and show the workflow for adding a new scene &#8211; including audio, textures and interactions.<\/li>\n<\/ul>\n<p>As I mentioned in a <a href=\"http:\/\/blogs.plymouth.ac.uk\/telmed\/2016\/05\/26\/icare-challenges-with-loading-many-assets-into-an-app\/\" target=\"_blank\">previous blog post<\/a>, scenes are loaded in 2 at a time. Each time this happens, certain bits of code are triggered to first remove (purge) the previous 2 scenes before grabbing textures for the next two scenes (the app looks in folders which are named by number for each scene &#8211; this is strict). All sprite sheets within these selected folders are loaded into an <a href=\"http:\/\/doc.starling-framework.org\/current\/starling\/utils\/AssetManager.html\" target=\"_blank\">Asset Manager<\/a>. Once this has completed, an xml file which contains all the required information for the newly loaded assets (more on this xml file later) is loaded and data is captured for the newly loaded scenes, including but not limited\u00a0to:<\/p>\n<p><a href=\"http:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/sprite-code-snippet.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-1146 alignleft\" src=\"http:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/sprite-code-snippet.png\" alt=\"sprite code snippet\" width=\"227\" height=\"138\" srcset=\"https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/sprite-code-snippet.png 227w, https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/sprite-code-snippet-160x97.png 160w\" sizes=\"auto, (max-width: 227px) 100vw, 227px\" \/><\/a><\/p>\n<p>This snippet for a sprite sits in the apps xml file. Data here provides the x and y positioning in the particular scene (number represents percentage in the viewport which is set to 1024 x 768 as standard), parallax for x and y which dictates the speed in which is animates in and out of view, touchable simply tells the app to listen for when it has been selected like a button (because its part of an interactive scene) and audio is the unique audio file to play once the sprite has been tapped.<\/p>\n<p>As each sprite is loaded from the xml file, its contents then dictates what happens next but they all get added to the stage as well as few other things depending on its complexity.<\/p>\n<p>Once all of this is complete, the audio is loaded and run depending on their settings, again dictated by the xml file.<\/p>\n<p>There&#8217;s a lot more complexities involved here. But in a nutshell, this is it!<\/p>\n<p>How is this easy to edit you wonder? Well, its pretty easy because now this is in place, all that is required to add a new for example is:<\/p>\n<ol>\n<li>add new folder in app directory\u00a0with new scene number and add sprite sheets to it.<\/li>\n<li>add audio to the audio folder in app directory (there are separate folders for voiceovers, background music and sound effects, pretty self explanatory).<\/li>\n<li>update the xml file listing the name of textures to use from the sprite sheets from the folder above and the audio.<\/li>\n<\/ol>\n<p>Thats it! See below screenshot\u00a0where you can see an example\u00a0how to include an interactive scene, with\u00a0audio. Obviously there are naming conventions for the xml to adhere to, but these don&#8217;t really vary much!<\/p>\n<p><a href=\"http:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/scene-9-xml.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1150\" src=\"http:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/scene-9-xml.png\" alt=\"scene 9 xml\" width=\"591\" height=\"931\" srcset=\"https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/scene-9-xml.png 591w, https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/scene-9-xml-190x300.png 190w, https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/scene-9-xml-560x882.png 560w, https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/scene-9-xml-260x410.png 260w, https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/scene-9-xml-160x252.png 160w\" sizes=\"auto, (max-width: 591px) 100vw, 591px\" \/><\/a><\/p>\n<p>Pretty simple right? We have a tool that generates most of the xml for us, but things like positioning\u00a0can be a bit trial and error. Making the app this way makes it super easy for us to add, remove or edit an entire scene(s) with minimal effort. There are a few things in the xml example I&#8217;ve yet to blog about: interactions and conditions. Will write up about those next!<\/p>\n<p>The current workflow for adding scenes involves some good teamwork! I&#8217;ve created a workflow which shows the processes involved:<\/p>\n<p><a href=\"http:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/iCARE-simplified-workflow-v2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1156\" src=\"http:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/iCARE-simplified-workflow-v2.png\" alt=\"iCARE simplified workflow\" width=\"833\" height=\"1015\" srcset=\"https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/iCARE-simplified-workflow-v2.png 833w, https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/iCARE-simplified-workflow-v2-246x300.png 246w, https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/iCARE-simplified-workflow-v2-768x936.png 768w, https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/iCARE-simplified-workflow-v2-560x682.png 560w, https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/iCARE-simplified-workflow-v2-260x317.png 260w, https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-content\/uploads\/sites\/96\/2016\/06\/iCARE-simplified-workflow-v2-160x195.png 160w\" sizes=\"auto, (max-width: 833px) 100vw, 833px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the criteria for this project was to eventually make it open source. Whilst I&#8217;m not sure if this will actually happen, it did make me think more about my code and how best to\u00a0approach the way in which new content gets added or changed. Few things this post will include are: How we&#8217;re [&hellip;]<\/p>\n","protected":false},"author":110,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[432,335,357,359,338],"tags":[],"class_list":["post-1139","post","type-post","status-publish","format-standard","hentry","category-app","category-game-based-learning-2","category-icare","category-interactive-comic-book","category-mobile"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pdVSkC-in","_links":{"self":[{"href":"https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-json\/wp\/v2\/posts\/1139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-json\/wp\/v2\/comments?post=1139"}],"version-history":[{"count":1,"href":"https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-json\/wp\/v2\/posts\/1139\/revisions"}],"predecessor-version":[{"id":6068,"href":"https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-json\/wp\/v2\/posts\/1139\/revisions\/6068"}],"wp:attachment":[{"href":"https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-json\/wp\/v2\/media?parent=1139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-json\/wp\/v2\/categories?post=1139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.plymouth.ac.uk\/digital-education\/wp-json\/wp\/v2\/tags?post=1139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}