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.
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.
Looks like you are destroying “myEnemy” when the sword hits an enemy sprite. The thing is, “myEnemy” is whichever sprite was most recently created with that variable, which is usually not going to be the sprite you want destroyed. What you need to do is drag the red “(sprite)” block down into the spot where the “myEnemy” variable is to replace it: