{"id":905,"date":"2026-02-13T09:27:17","date_gmt":"2026-02-13T01:27:17","guid":{"rendered":"https:\/\/edu.circuspi.com\/?p=905"},"modified":"2026-03-09T16:05:45","modified_gmt":"2026-03-09T08:05:45","slug":"9-3-making-sprites-move-automatically-reducing-life","status":"publish","type":"post","link":"https:\/\/edu.circuspi.com\/index.php\/gamebit-en\/9-3-making-sprites-move-automatically-reducing-life\/","title":{"rendered":"9.3 Making Sprites Move Automatically \u2013 Reducing Life"},"content":{"rendered":"\n<p>We taught the method for triggering events when sprites touch in Unit 6: the &#8220;<strong>Overlaps<\/strong>&#8221; block in the &#8220;<strong>Sprites<\/strong>&#8221; list. The difference this time is that we need to set the <em>other<\/em> Kind to &#8220;<strong>Enemy<\/strong>.&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"549\" height=\"203\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-09-3_01.png\" alt=\"\" class=\"wp-image-1233\"\/><\/figure>\n\n\n\n<p>When the player touches the villain, we will change the initial life value. Click on &#8220;<strong>Info<\/strong>&#8221; in the <strong>Block Toolbox<\/strong> and find &#8220;<strong>change life by ( -1 )<\/strong>.&#8221; The usage is the same as &#8220;<strong>change score<\/strong>.&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"573\" height=\"226\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-09-3_02.png\" alt=\"\" class=\"wp-image-1234\"\/><\/figure>\n\n\n\n<p>The &#8220;<strong>on overlaps<\/strong>&#8221; block functions such that it executes continuously as long as the sprites are overlapping. Because the program runs very fast, it might happen that before you can separate the sprites, your health is drained instantly. Therefore, we need to pause the program briefly upon contact (creating a temporary invincibility or cooldown period).<\/p>\n\n\n\n<p>Click on &#8220;<strong>Loops<\/strong>&#8221; in the <strong>Block Toolbox<\/strong> to find the &#8220;<strong>pause ( 100 ) ms<\/strong>&#8221; block.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"424\" height=\"534\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-09-3_03.png\" alt=\"\" class=\"wp-image-1235\"\/><\/figure>\n\n\n\n<p>Drag this block out and place it <strong>below<\/strong> &#8220;<strong>change life by ( -1 )<\/strong>.&#8221; This prevents instant death from rapid health deduction!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"565\" height=\"258\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-09-3_04.png\" alt=\"\" class=\"wp-image-1236\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>We taught the method for triggering events when sprites [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":454,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,23],"tags":[],"table_tags":[],"class_list":{"0":"post-905","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-gamebit-en","8":"category-freeinfo-en","9":"czr-hentry"},"_links":{"self":[{"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/posts\/905","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/comments?post=905"}],"version-history":[{"count":2,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/posts\/905\/revisions"}],"predecessor-version":[{"id":1248,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/posts\/905\/revisions\/1248"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/media\/454"}],"wp:attachment":[{"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/media?parent=905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/categories?post=905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/tags?post=905"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/table_tags?post=905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}