{"id":5604,"date":"2025-01-01T04:25:43","date_gmt":"2025-01-01T04:25:43","guid":{"rendered":"https:\/\/obsidiansofteducation.com\/?page_id=5604"},"modified":"2026-07-27T05:51:28","modified_gmt":"2026-07-27T05:51:28","slug":"animation-in-mit-app-inventor-animated-sprites","status":"publish","type":"page","link":"https:\/\/obsidiansofteducation.com\/index.php\/animation-in-mit-app-inventor-animated-sprites\/","title":{"rendered":"Animation in MIT App Inventor &#8211; Animated Sprites"},"content":{"rendered":"\n<p class=\"has-medium-font-size wp-block-paragraph\">Hello friends,<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Welcome to Obsidian Soft.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">In this class, I will tell you how to make animated sprites in MIT app Inventor.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/snake20game206.png\" alt=\"\" style=\"width:645px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Need a custom MIT App Inventor app?<\/strong><br>If you would rather focus on your idea than the implementation, I also offer professional MIT App Inventor development and consulting on Fiverr. Feel free to check out my gig.<\/p>\n\n\n\n<p class=\"has-vivid-cyan-blue-color has-text-color has-link-color has-medium-font-size wp-elements-1 wp-block-paragraph\"><a href=\"https:\/\/www.fiverr.com\/s\/0byd1gE\" target=\"_blank\" rel=\"noopener\">https:\/\/www.fiverr.com\/s\/0byd1gE<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">We can show animated gifs by using Webviewer as I showed in my Voice Assistant ChatGPT tutorial but how to show frame-by-frame animation in which we have different frames or costumes of the same image and using the frames, we want to show an animated sprite. I am using the word costumes as many of you must have done MIT Scratch before moving on to MIT App Inventor.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Let&#8217;s begin by first downloading the different costumes of a zombie for walking animation.&nbsp;<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><a href=\"https:\/\/opengameart.org\/content\/mini-zombie\" target=\"_blank\" rel=\"noopener\">https:\/\/opengameart.org\/content\/mini-zombie<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Download the zombie zip file. Open it up using any unzipping software. You will find the walk folder inside it. Rename all images in the correct order from 1-8. The first frame will be 1.png and so on.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Create a new project in MIT App Inventor. Call it AnimatedSprite.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Upload media i.e. the 8 png files. You can optionally upload a scary background.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Drag and drop a canvas onto screen1. Choose the background if you uploaded one as the canvas\u2019s background. Make height 80% and width fill parent. Drag and drop an image sprite from <strong>Drawing and Animation<\/strong> to the canvas. Make height 144 pixels and width 166 pixels. Choose 1.png as the picture. Also very important, uncheck rotates.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Drag and drop a horizontal layout. Make height 15% and width fill parent.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Drag a button onto the layout from <strong>User Interface<\/strong>. Rename to leftBtn. Make font bold and font size 20. Make background color black. Change text to &#8220;Left&#8221; and text color to white. Select the leftBtn and duplicate. You can duplicate components in the designer view of MIT App Inventor by pressing Command + C and Command V for MacOS or Ctrl + C and Ctrl + V for Windows. Rename duplicated button to rightBtn. Change the text to &#8220;Right&#8221;.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Drag and drop a clock from the <strong>Sensors<\/strong>. Uncheck timer always fires and timer enabled.&nbsp; And make the timer interval 41 milliseconds. I will explain why I have made this 41 later.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Go to the blocks section. Make a global variable for the frames count as we need to keep a count of how many frames we have shown. Use a maths block to make it 1 because we are always showing the 1.png<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"664\" height=\"102\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-45.png\" alt=\"\" class=\"wp-image-5607\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-45.png 664w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-45-300x46.png 300w\" sizes=\"auto, (max-width: 664px) 100vw, 664px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Next, make a procedure for starting the animation.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"874\" height=\"416\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-47.png\" alt=\"\" class=\"wp-image-5609\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-47.png 874w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-47-300x143.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-47-768x366.png 768w\" sizes=\"auto, (max-width: 874px) 100vw, 874px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">First, we make sure that our frame count is always reset to 1 at the beginning of the animation.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">And our picture is also 1.png<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Then, we set the speed to 2 pixels and interval to 41. This means that our sprite will move 2 pixels every 41 milliseconds.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Secondly, we enable the image sprite as this tells the image sprite to start using its speed and other properties to become animated. Now, what about our different costumes of zombie? We will enable our timer.&nbsp; And remember that it will run every 41 milliseconds as this is the timer interval that we set for our clock. The industry standard for animated films is 24 frames per second (fps).<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>24 fps means 1 frame in 1\/24 seconds which if converted into milliseconds is 1 frame in 41 ms.<\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">So, we will change the frame of our image sprite every 41 ms. At the same time, it will move 2 pixels. So, we are achieving two things in those 41 ms: a change in costume and a movement of 2 pixels and this is how our zombie will be doing his clumsy walk.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"415\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-48-1024x415.png\" alt=\"\" class=\"wp-image-5610\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-48-1024x415.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-48-300x122.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-48-768x312.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-48.png 1336w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">In our timer event, we will check if we have shown all frames or not. We will update the frame counter and show the next frame by doing a join with frame count to make the image file name for the next frame to be shown.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">If the frame count is not less than 8 i.e. it must be now 8. This means that we have shown all 8 frames and we should stop changing costumes and also stop our animation. So, disable the zombie image and disable the timer too.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now, our right and left buttons will determine the direction of movement<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">So when the right button is clicked, we choose the heading as 0 and call our startAnimation procedure.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"796\" height=\"250\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-46.png\" alt=\"\" class=\"wp-image-5608\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-46.png 796w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-46-300x94.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-46-768x241.png 768w\" sizes=\"auto, (max-width: 796px) 100vw, 796px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Duplicate, change to left btn click event. And change the heading to <strong>180<\/strong>.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">So we are done. I hope you have fun animating your sprites this way. This is very much needed while making games with a better user experience as game players would be more fascinated by a zombie actually doing that clumsy zombie walk instead of just sliding left and right. You just need different frames or costumes for your image and a clock sensor to shift between the different costumes.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Need help with your own project or want to customise this app further?<\/strong><br>Whether you need a completely custom MIT App Inventor app, additional features, Firebase integration, APIs, AI, bug fixes, or one-to-one guidance, I would be happy to help. Check out my <strong><a href=\"https:\/\/www.fiverr.com\/s\/0byd1gE\" target=\"_blank\" rel=\"noopener\">Fiverr gig<\/a> <\/strong>to discuss your project.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.fiverr.com\/s\/0byd1gE\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"615\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2026\/07\/Business-1024x615.png\" alt=\"Fiverr gig thumbnail\" class=\"wp-image-7009\" style=\"aspect-ratio:1.6650664354074396;width:564px;height:auto\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2026\/07\/Business-1024x615.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2026\/07\/Business-300x180.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2026\/07\/Business-768x461.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2026\/07\/Business.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">If you like my tutorials, please consider supporting me:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><a href=\"https:\/\/obsidiansoft.gumroad.com\/coffee\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"372\" height=\"196\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1.png\" alt=\"\" class=\"wp-image-5381\" style=\"aspect-ratio:1.8981115971407234;width:278px;height:auto\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1.png 372w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1-300x158.png 300w\" sizes=\"auto, (max-width: 372px) 100vw, 372px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">You can download the aia file for this project.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong><a href=\"https:\/\/drive.google.com\/file\/d\/1dOJ9uq80QDcRQv0G2lO2TuH7NDTFbFQs\/view?usp=share_link\" target=\"_blank\" rel=\"noopener\">Download project file<\/a><\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">You can have a look at the video tutorial here:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<p class=\"responsive-video-wrap clr\"><iframe loading=\"lazy\" title=\"Animated Sprites in MIT App Inventor | Frame Animation in MIT App Inventor | Sprite Animation\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/nPWTCR_DygQ?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<\/div><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Please like my video and share it with your friends and family. Also, subscribe to my channel and press the bell icon so that you don&#8217;t miss any of the great projects that I have planned for you.&nbsp;<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><a href=\"https:\/\/www.youtube.com\/c\/obsidiansofteducation\" target=\"_blank\" rel=\"noopener\">https:\/\/www.youtube.com\/c\/obsidiansofteducation<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Please like my Facebook page and Instagram page for more educational resources and tips.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Facebook:<\/strong>&nbsp;<strong><a href=\"https:\/\/www.facebook.com\/ObsidianSoft\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.facebook.com\/ObsidianSoft\/<\/a><\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Instagram:<\/strong>&nbsp;<a href=\"https:\/\/www.instagram.com\/obsidiansoftapps\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>https:\/\/www.instagram.com\/obsidiansoftapps\/<\/strong><\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Pinterest:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-pinterest wp-block-embed-pinterest\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"oceanwp-oembed-wrap clr\"><iframe loading=\"lazy\" title=\"Obsidian Soft\" src=\"https:\/\/assets.pinterest.com\/ext\/embed.html?grid=obsidiansoft&#038;src=oembed\" height=\"900\" width=\"450\" frameborder=\"0\" scrolling=\"no\" ><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">For links to free educational apps, have a look at the&nbsp;<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/mobile-apps\/\" target=\"_blank\" rel=\"noreferrer noopener\">educational apps page<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello friends, Welcome to Obsidian Soft. In this class, I will tell you how to make animated sprites in MIT app Inventor. Need a custom MIT App Inventor app?If you would rather focus on your idea than the implementation, I also offer professional MIT App Inventor development and consulting on Fiverr. Feel free to check [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5604","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/comments?post=5604"}],"version-history":[{"count":4,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5604\/revisions"}],"predecessor-version":[{"id":7015,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5604\/revisions\/7015"}],"wp:attachment":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/media?parent=5604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}