In my “Super Smash Bros” game, the darts are shot from the sprite, so the sprite that shoots the dart also gets damaged. Also, it seems that the two sprites have different health even though they have the same status bar width. How can I fix these issues?
There are two different strategies I use in these scenarios.
Create two different sprite kinds for the projectiles (e.g. Player1Projectile and Player2Projectile) and two sprite kinds for the players (Player1Sprite and Player2Sprite)
Use the arcade-sprite-data extension to store the “owner” of the projectile and check it when overlapping
#1 is probably easier to understand, but it ends up with a lot of code duplication. #2 is the better option if you don’t mind using the sprite data extension.
As for the status bars, they do have the same health in the code you linked; it just seems like they’re doing different amounts of damage because of how long the projectiles are overlapping with each player sprite. You should probably destroy the projectile when the overlap happens so that it doesn’t keep firing.
One other quick note: the width of the status bar doesn’t determine it’s max value, it’s just for show. All status bars default to 100 for the max value and you can change it by using the same block you use to set the value (change the dropdown to the max option)