# Broken Bad guys

**URL:** <https://forum.makecode.com/t/broken-bad-guys/33324>\
**Category:** Help\
**Created:** [January 21, 2025, 5:42pm UTC](https://forum.makecode.com/t/broken-bad-guys/33324 "2025-01-21T17:42:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MR.CODDER](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mr.codder/32/20850_2.png) [@MR.CODDER](https://forum.makecode.com/u/MR.CODDER)\
**Post date:** [January 21, 2025, 5:42pm UTC](https://forum.makecode.com/t/broken-bad-guys/33324/1 "2025-01-21T17:42:50Z")

</div>

so in the post I made a few days ago my 2 player platformer has been broken but know I was working a on a one-player version it was going good I was about to test the boss level when I jumped on the first bad guy to destroy it there was a error

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/1/4/14bc4da659524d70128fe9b9fb228e4f7eeabb61.png)  
Does anyone know how to fix it see the error in further depth here:[https://arcade.makecode.com/S98835-49200-75574-21981](https://arcade.makecode.com/S98835-49200-75574-21981)

---

<div class="post-metadata">

**Author:** ![randomuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/randomuser/32/32505_2.png) [@randomuser](https://forum.makecode.com/u/randomuser)\
**Post date:** [January 22, 2025, 5:29pm UTC](https://forum.makecode.com/t/broken-bad-guys/33324/2 "2025-01-22T17:29:26Z")

</div>

In the code, you destroy ‘othersprite’ first, then try to set its velocity. Its giving the ‘failed cast on null’ error because since it’s destroyed, it doesn’t exist, and you’re refferring to nothing! An easy fix, just put the destruction after the velocities : - )

---

<div class="post-metadata">

**Author:** ![MR.CODDER](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mr.codder/32/20850_2.png) [@MR.CODDER](https://forum.makecode.com/u/MR.CODDER)\
**Post date:** [January 22, 2025, 6:50pm UTC](https://forum.makecode.com/t/broken-bad-guys/33324/3 "2025-01-22T18:50:49Z")

</div>

thank you
