Broken Bad guys

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


Does anyone know how to fix it see the error in further depth here:https://arcade.makecode.com/S98835-49200-75574-21981

1 Like

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 : - )

thank you

1 Like