{"id":933,"date":"2026-02-13T09:53:32","date_gmt":"2026-02-13T01:53:32","guid":{"rendered":"https:\/\/edu.circuspi.com\/?p=933"},"modified":"2026-03-09T16:29:17","modified_gmt":"2026-03-09T08:29:17","slug":"11-1-4-method-for-jumping","status":"publish","type":"post","link":"https:\/\/edu.circuspi.com\/index.php\/gamebit-en\/11-1-4-method-for-jumping\/","title":{"rendered":"11.1.4 Method for Jumping"},"content":{"rendered":"\n<p>For movement, we can refer to &#8220;<strong>Projectiles<\/strong>.&#8221; Projectiles move because we adjusted their <strong>Velocity<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"844\" height=\"243\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-11-1-4_01.png\" alt=\"\" class=\"wp-image-1292\"\/><\/figure>\n\n\n\n<p>By the same logic, if we adjust the character&#8217;s velocity, can it fly into the sky? Yes! In the &#8220;<strong>Sprites<\/strong>&#8221; category, you can find blocks to change sprite position and velocity.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"865\" height=\"661\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-11-1-4_02.png\" alt=\"\" class=\"wp-image-1293\"\/><\/figure>\n\n\n\n<p>Once velocity is changed, if not adjusted again, it will maintain that state (flying upwards forever).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1272\" height=\"1050\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-11-1-4_03.gif\" alt=\"\" class=\"wp-image-1294\"\/><\/figure>\n\n\n\n<p>So, let&#8217;s use the &#8220;<strong>pause (ms)<\/strong>&#8221; block. After flying up for a short time, we change the velocity to the opposite direction (downwards) to make it fall.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"510\" height=\"281\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-11-1-4_04.png\" alt=\"\" class=\"wp-image-1295\"\/><\/figure>\n\n\n\n<p>To prevent the player from spamming the &#8220;<strong>A button<\/strong>&#8221; and causing unexpected behavior (like infinite jumping), we add a check condition: only trigger the jump when the character&#8217;s <strong>Velocity (vy)<\/strong> is &#8220;<strong>0<\/strong>.&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"361\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-11-1-4_05.png\" alt=\"\" class=\"wp-image-1296\"\/><\/figure>\n\n\n\n<p>Okay, now the character keeps falling downwards forever, right? This is because the velocity hasn&#8217;t been reset to &#8220;<strong>0<\/strong>.&#8221;<\/p>\n\n\n\n<p> We need to restrict the character so that when it hits the &#8220;ground,&#8221; the velocity becomes &#8220;<strong>0<\/strong>.&#8221; Assuming the character&#8217;s ground position is at <strong>y = 60<\/strong>: We can continuously check the character&#8217;s &#8220;<strong>y coordinate<\/strong>&#8221; during the game. As long as it is <strong>equal to or greater than 60<\/strong> (the lower the position, the larger the number), we set the character&#8217;s velocity back to &#8220;<strong>0<\/strong>,&#8221; as shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"508\" height=\"324\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-11-1-4_06.png\" alt=\"\" class=\"wp-image-1297\"\/><\/figure>\n\n\n\n<p>This way, the character can jump and land normally.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"902\" height=\"740\" src=\"https:\/\/edu.circuspi.com\/wp-content\/uploads\/2026\/02\/eng-11-1-4_07.gif\" alt=\"\" class=\"wp-image-1298\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>For movement, we can refer to &#8220;Projectiles.&#038;#8221 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":520,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,23],"tags":[],"table_tags":[],"class_list":{"0":"post-933","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\/933","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=933"}],"version-history":[{"count":2,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/posts\/933\/revisions"}],"predecessor-version":[{"id":1308,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/posts\/933\/revisions\/1308"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/media\/520"}],"wp:attachment":[{"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/media?parent=933"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/categories?post=933"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/tags?post=933"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/edu.circuspi.com\/index.php\/wp-json\/wp\/v2\/table_tags?post=933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}