# I can't figure out why my game is crashing

**URL:** <https://forum.makecode.com/t/i-cant-figure-out-why-my-game-is-crashing/20882>\
**Category:** Help\
**Tags:** game\
**Created:** [June 26, 2023, 4:20pm UTC](https://forum.makecode.com/t/i-cant-figure-out-why-my-game-is-crashing/20882 "2023-06-26T16:20:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arexcl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/arexcl/32/10427_2.png) [@Arexcl](https://forum.makecode.com/u/Arexcl)\
**Post date:** [June 26, 2023, 4:20pm UTC](https://forum.makecode.com/t/i-cant-figure-out-why-my-game-is-crashing/20882/1 "2023-06-26T16:20:29Z")

</div>

I’ve been working on a game but when you swing your sword it will sometimes crash. Can someone find the problem in the code? here’s the link:

> **[Cyber Fusion](https://arcade.makecode.com/S40804-22135-57123-60129)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [June 26, 2023, 7:36pm UTC](https://forum.makecode.com/t/i-cant-figure-out-why-my-game-is-crashing/20882/2 "2023-06-26T19:36:28Z")

</div>

Your pixel art is amazing!!

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [June 26, 2023, 8:55pm UTC](https://forum.makecode.com/t/i-cant-figure-out-why-my-game-is-crashing/20882/3 "2023-06-26T20:55:02Z")

</div>

> **[Cyber Fusion](https://arcade.makecode.com/S89093-80079-39710-96909)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I changed the while true blocks to on button pressed which fixed things. The issue was actually the walking I think.  
I also fixed the attack which would attack multiple times without input if I spammed B with a timer block.  
I would recommend delaying the big swipe attack after the shockwave as it is a bit obstructed by it and I think the attack looks amazing.

---

<div class="post-metadata">

**Author:** ![Arexcl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/arexcl/32/10427_2.png) [@Arexcl](https://forum.makecode.com/u/Arexcl)\
**Post date:** [June 26, 2023, 9:49pm UTC](https://forum.makecode.com/t/i-cant-figure-out-why-my-game-is-crashing/20882/4 "2023-06-26T21:49:16Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [June 29, 2023, 4:42pm UTC](https://forum.makecode.com/t/i-cant-figure-out-why-my-game-is-crashing/20882/5 "2023-06-29T16:42:27Z")

</div>

Great art, but I wanted to point out you misspelled “laun **ch** ed” as “laun **c** ed” in that intro. Just wanted to point that out if you want to fix it
