Player take different amounts of damage depending which enemy the player hits

So I currently have my player take damage when it collides with a group (enemies). Currently it is linked to a variable which makes the player take 25 damage. But I want the player to take the amount of damage which different enemies deal. How would I accomplish this? I was thinking of giving each enemy a variable to dictate this. But I don’t know what action and command would do this. I appreciate any help.

Don’t check the collision with the group but with the enemy object? If you use the same object for different enemies, you need an object veribale.

edit: Okay, I saw in the other thread why you use a group. You can do it like this, but I don’t think you need a group.

You can look at how I do this in the Advanced Platformer/Not A Vania Redux example that’s now included in the engine.

To make this just one event:
Give every enemy a enemyDMG variable. Set that to whatever damage you want to apply to the player.
Change the scene variable health (or player variable, or whatever you have set up) to subtract: enemies.Variable(enemyDMG)

1 Like