Microsoft MakeCode

Coding a sword type weapon?

Hello,

I am looking to code a sword or other weapon that my sprite can swing. I want the sword to be able to destroy enemies it hits but am struggling to find a good way to do so.

So far I have made the sword a projectile but am looking for other ideas. I know that making a firing projectile would be easier but I have done that in another game.

Thanks for your help

1 Like

Here’s a trick I’ve used to do this before:

Try moving around and pressing the A button to swing.

The basic idea is that the sword can be a regular sprite that’s always invisible except when it’s being used. When you press the A button, change the invisible image to a sword image and then change it back after a pause.

1 Like

Thank you so much. This is exactly the kind of thing I was looking for.