{"id":920,"date":"2026-02-13T09:37:37","date_gmt":"2026-02-13T01:37:37","guid":{"rendered":"https:\/\/edu.circuspi.com\/?p=920"},"modified":"2026-03-09T16:20:08","modified_gmt":"2026-03-09T08:20:08","slug":"10-3-learning-to-adjust-missile-firing-direction","status":"publish","type":"post","link":"https:\/\/edu.circuspi.com\/index.php\/gamebit-en\/10-3-learning-to-adjust-missile-firing-direction\/","title":{"rendered":"10.3 Learning to Adjust Missile Firing Direction"},"content":{"rendered":"\n<p>Making a sprite fire missiles is not complicated. The relevant blocks are located in the &#8220;<strong>Sprites<\/strong>&#8221; category. Look closely, and you will see two blocks related to &#8220;<strong>Projectiles<\/strong>&#8220;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"916\" height=\"307\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-10-3_01.png\" alt=\"\" class=\"wp-image-1263\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>projectile from side:<\/strong> The first block is used to set projectiles generated from the &#8220;<strong>background<\/strong>&#8221; (side). Using the &#8220;Space Destroyer&#8221; example, the &#8220;<strong>Meteors<\/strong>&#8221; in that game are generated using this block.<\/li>\n\n\n\n<li><strong>projectile from sprite:<\/strong> The second block, as the name suggests, creates projectiles from a &#8220;<strong>Sprite<\/strong>.&#8221; In &#8220;Space Destroyer,&#8221; the laser beams fired by the fighter jet are created using this block.<\/li>\n<\/ol>\n\n\n\n<p>To add the attack function to our character, we need the <strong>second block<\/strong>. Drag it out first.<\/p>\n\n\n\n<p>We want the attack timing to be controlled by the player, so click on the &#8220;<strong>Controller<\/strong>&#8221; category and drag out the &#8220;<strong>on [A] button [pressed]<\/strong>&#8221; block.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"396\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-10-3_02.png\" alt=\"\" class=\"wp-image-1264\"\/><\/figure>\n\n\n\n<p>Combine these two blocks. You can draw the &#8220;<strong>Pattern<\/strong>&#8221; for the projectile (e.g., a small flame) or select one from the <strong>Gallery<\/strong>. Next, select the variable name of the <strong>player-controlled sprite<\/strong>. The &#8220;<strong>vx<\/strong>&#8221; and &#8220;<strong>vy<\/strong>&#8221; at the end represent the &#8220;<strong>Velocity<\/strong>&#8221; in the X and Y directions, respectively. The adjustable range is -100 to 100.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>vy:<\/strong> Velocity Y (Vertical speed). Positive is Down, Negative is Up.<\/li>\n\n\n\n<li><strong>vx:<\/strong> Velocity X (Horizontal speed). Positive is Right, Negative is Left.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"748\" height=\"177\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-10-3_03.png\" alt=\"\" class=\"wp-image-1265\"\/><\/figure>\n\n\n\n<p>The effect of speed adjustment is shown below; feel free to experiment. Positive and negative values change the direction. Try changing <strong>vx<\/strong> to 30 and <strong>vy<\/strong> to 75, and see the result in the simulator.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"609\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-10-3_04.png\" alt=\"\" class=\"wp-image-1266\"\/><\/figure>\n\n\n\n<p>To make the drawn &#8220;Small Flame&#8221; move at maximum speed in the direction the character is facing, set it to move straight (e.g., from left to right, set <strong>vx<\/strong> to a positive value like 100 and <strong>vy<\/strong> to 0).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"862\" height=\"238\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-10-3_05.png\" alt=\"\" class=\"wp-image-1267\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Making a sprite fire missiles is not complicated. The r [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":486,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,23],"tags":[],"table_tags":[],"class_list":{"0":"post-920","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\/920","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=920"}],"version-history":[{"count":2,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/posts\/920\/revisions"}],"predecessor-version":[{"id":1275,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/posts\/920\/revisions\/1275"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/media\/486"}],"wp:attachment":[{"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/media?parent=920"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/categories?post=920"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/tags?post=920"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/table_tags?post=920"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}