{"id":908,"date":"2026-02-13T09:28:52","date_gmt":"2026-02-13T01:28:52","guid":{"rendered":"https:\/\/edu.circuspi.com\/?p=908"},"modified":"2026-03-09T16:06:49","modified_gmt":"2026-03-09T08:06:49","slug":"9-4-2-teleporting","status":"publish","type":"post","link":"https:\/\/edu.circuspi.com\/index.php\/gamebit-en\/9-4-2-teleporting\/","title":{"rendered":"9.4.2 Teleporting"},"content":{"rendered":"\n<p>Another method is to make the enemy instantly &#8220;<strong>Change Position<\/strong>&#8221; at a &#8220;<strong>Fixed Frequency<\/strong>.&#8221; For example, setting the enemy to change position every two seconds creates a thrill when the enemy suddenly appears in front of you during gameplay.<\/p>\n\n\n\n<p>We learned how to randomly change positions in previous units. The key is: <em>How do we automatically change the position after a specific interval?<\/em><\/p>\n\n\n\n<p>We can use the &#8220;<strong>on game update every ( 500 ) ms<\/strong>&#8221; block found in the &#8220;<strong>Game<\/strong>&#8221; category.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"568\" height=\"323\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-09-4-2_01.png\" alt=\"\" class=\"wp-image-1241\"\/><\/figure>\n\n\n\n<p>When we set the &#8220;<strong>Interval<\/strong>,&#8221; this block will continuously run the code inside it according to that interval. We want to change the enemy&#8217;s position every 2 seconds, so enter <strong>2000<\/strong> (since the unit is milliseconds) or select <strong>2 seconds<\/strong> from the dropdown menu.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"298\" height=\"147\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-09-4-2_02.png\" alt=\"\" class=\"wp-image-1242\"\/><\/figure>\n\n\n\n<p>Finally, place the &#8220;<strong>Random Position<\/strong>&#8221; method inside this block. <strong>Remember to select the Enemy&#8217;s variable name.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"596\" height=\"177\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-09-4-2_03.png\" alt=\"\" class=\"wp-image-1243\"\/><\/figure>\n\n\n\n<p>Once finished, try playing it in the <strong>Game Simulator<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"266\" height=\"362\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-09-4-2_04.gif\" alt=\"\" class=\"wp-image-1244\"\/><\/figure>\n\n\n\n<p>In this unit, we learned about &#8220;<strong>Life (Health)<\/strong>&#8221; and &#8220;<strong>Animating Sprites<\/strong>.&#8221; In addition to the original tension of the time limit, the addition of the villain adds a lot of excitement and fun to the process. Currently, the gameplay mainly involves using the joystick to dodge.<\/p>\n\n\n\n<p>Next, we will add the ability for the character to attack, just like the fighter jet in the &#8220;Space Destroyer&#8221; example, which can fire beams to destroy meteors.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Another method is to make the enemy instantly &#8220;Ch [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":462,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,23],"tags":[],"table_tags":[],"class_list":{"0":"post-908","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\/908","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=908"}],"version-history":[{"count":2,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/posts\/908\/revisions"}],"predecessor-version":[{"id":1251,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/posts\/908\/revisions\/1251"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/media\/462"}],"wp:attachment":[{"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/media?parent=908"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/categories?post=908"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/tags?post=908"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/table_tags?post=908"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}