{"id":952,"date":"2025-05-14T00:20:51","date_gmt":"2025-05-14T00:20:51","guid":{"rendered":"https:\/\/sites.wsagames.com\/aa14g23\/?p=952"},"modified":"2025-05-14T17:38:37","modified_gmt":"2025-05-14T17:38:37","slug":"player-p2-altering-the-dash","status":"publish","type":"post","link":"https:\/\/sites.wsagames.com\/aa14g23\/2025\/05\/14\/player-p2-altering-the-dash\/","title":{"rendered":"Player P2 [Altering the Dash]"},"content":{"rendered":"\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"908\" height=\"156\" src=\"https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-14-182043.png\" alt=\"\" class=\"wp-image-973\" srcset=\"https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-14-182043.png 908w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-14-182043-300x52.png 300w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-14-182043-768x132.png 768w\" sizes=\"(max-width: 908px) 100vw, 908px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p>Following up from implementation, I had to tweak my original code to prevent the player from changing their direction when the dash is active, to make the dash mechanic skillfully rewarding to better players. I tried to implement it but got frustrated as after I tweaked the code, it broke it and made the dash go on infinitely, look below to see how I fixed it and made it work perfectly!<\/p>\n<\/div>\n<\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p class=\"has-text-align-center has-extra-large-font-size\"><strong>Team Discussion<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image alignleft size-full\"><img decoding=\"async\" width=\"820\" height=\"418\" src=\"https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-13-192500.png\" alt=\"\" class=\"wp-image-954\" srcset=\"https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-13-192500.png 820w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-13-192500-300x153.png 300w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-13-192500-768x391.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/figure>\n\n\n\n<p>After receiving feedback from our Lead Programmer, E-Jay, I had to revisit my code and do some tweaking. My code was complimented, but to fit in with the roguelite vibe, the player shouldn&#8217;t be able to turn\/change direction mid-dash. So I had to get cracking on a fix in response.<\/p>\n\n\n\n<p>I tried to research how to do this without a lead from him. As this is my second experience coding, I found it terribly difficult. I couldn&#8217;t find anything specific to it, but E-Jay gave me a suggestion after I expressed my struggle. He suggested to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a bool to store if the player is dashing or can dash.<\/li>\n\n\n\n<li>Add those bools into the current code when active\/inactive.<\/li>\n\n\n\n<li>In the update method, check if the player is dashing and make it return to nothing.<\/li>\n<\/ul>\n\n\n\n<p>After getting some direction from this response, I could now find material to aid me in creating this.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p class=\"has-text-align-center has-extra-large-font-size\"><strong>Research<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\" style=\"margin-top:0;margin-bottom:0\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Simple DASH Mechanic in Unity\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/VWaiU7W5HdE?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>\n<\/div><\/figure>\n\n\n\n<p>This video completely encapsulates what E-Jay told me I needed to achieve the locking aspect of the dash. I will use this video to aid me in the order that I need to implement those features, as Unity plays code from the top to the bottom in its methods.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p class=\"has-text-align-center has-extra-large-font-size\"><strong>Production<\/strong><\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"has-text-align-center\"><strong>First Try<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img decoding=\"async\" width=\"511\" height=\"1024\" src=\"https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-02-13-110212-511x1024.png\" alt=\"\" class=\"wp-image-971\" style=\"width:511px;height:auto\" srcset=\"https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-02-13-110212-511x1024.png 511w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-02-13-110212-150x300.png 150w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-02-13-110212.png 614w\" sizes=\"(max-width: 511px) 100vw, 511px\" \/><\/figure>\n\n\n\n<p>Here is the original updated code, I&#8217;ve added in two new bools (<strong>isdashing and candash<\/strong>) and have given them their own section. These will store the current state of these two effects and will get updated when the dash becomes active or inactive. After I did this, the dash became infinite and would not stop, I became super frustrated with it and gave up, asking E-Jay for help. Understandably he was busy with working out the games procedural generation, so I decided to give it another go.<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"has-text-align-center\"><strong>Second Try<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"642\" height=\"1024\" src=\"https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-02-13-121219-642x1024.png\" alt=\"\" class=\"wp-image-972\" srcset=\"https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-02-13-121219-642x1024.png 642w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-02-13-121219-188x300.png 188w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-02-13-121219-768x1224.png 768w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-02-13-121219.png 813w\" sizes=\"(max-width: 642px) 100vw, 642px\" \/><\/figure>\n\n\n\n<p>After doing a test run, I found that it wouldn&#8217;t work. This was due to the order of the code. I had to alter the order by placing the <strong>if is dashing<\/strong> statement under the input key code section. This made it so the game would check to see if the player pressed the input and made it active, rather than going straight to checking if the dash was active, not giving the player a chance to press an input. This fixed the &#8216;infinite dash glitch&#8217; I encountered.<\/p>\n<\/div>\n<\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p class=\"has-text-align-center has-extra-large-font-size\"><strong>Personal Review<\/strong><\/p>\n\n\n\n<p>I learnt a bunch from encountering my first bug in this project. It taught me to be patient with myself and to give myself a chance to work things out, rather than taking the easy way out from getting someone else to do it. I learnt what it means to be a coder by solving the problem myself and to always put notes in my code so I understand what is happening with each line of code.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"521\" src=\"https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-14-183106-1024x521.png\" alt=\"\" class=\"wp-image-976\" srcset=\"https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-14-183106-1024x521.png 1024w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-14-183106-300x153.png 300w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-14-183106-768x390.png 768w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-14-183106.png 1070w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1007\" height=\"113\" src=\"https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-14-183602.png\" alt=\"\" class=\"wp-image-978\" srcset=\"https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-14-183602.png 1007w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-14-183602-300x34.png 300w, https:\/\/sites.wsagames.com\/aa14g23\/wp-content\/uploads\/sites\/3\/2025\/05\/Screenshot-2025-05-14-183602-768x86.png 768w\" sizes=\"(max-width: 1007px) 100vw, 1007px\" \/><\/figure>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Following up from implementation, I had to tweak my original code to prevent the player from changing their direction when the dash is active, to make the dash mechanic skillfully rewarding to better players. I tried to implement it but got frustrated as after I tweaked the code, it broke it and made the dash [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-952","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/sites.wsagames.com\/aa14g23\/wp-json\/wp\/v2\/posts\/952","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.wsagames.com\/aa14g23\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.wsagames.com\/aa14g23\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.wsagames.com\/aa14g23\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.wsagames.com\/aa14g23\/wp-json\/wp\/v2\/comments?post=952"}],"version-history":[{"count":4,"href":"https:\/\/sites.wsagames.com\/aa14g23\/wp-json\/wp\/v2\/posts\/952\/revisions"}],"predecessor-version":[{"id":979,"href":"https:\/\/sites.wsagames.com\/aa14g23\/wp-json\/wp\/v2\/posts\/952\/revisions\/979"}],"wp:attachment":[{"href":"https:\/\/sites.wsagames.com\/aa14g23\/wp-json\/wp\/v2\/media?parent=952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.wsagames.com\/aa14g23\/wp-json\/wp\/v2\/categories?post=952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.wsagames.com\/aa14g23\/wp-json\/wp\/v2\/tags?post=952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}