Problems with enemies in a platformer

Here is my dilemma.
I want my enemies to act much like the enemies in a typical platformer, like Super Mario. For my player to be able to kill these enemies I would like for the player to either use a weapon, which I think I can implement quite easily. However, the more difficult aspect is by having the player jump on the head of the enemy, much like Super Mario. Can I implement a way for the player to die on contact with an enemy, but destroy the enemy if the player comes in contact with their "head"?
I want my enemies to act much like the enemies in a typical platformer, like Super Mario. For my player to be able to kill these enemies I would like for the player to either use a weapon, which I think I can implement quite easily. However, the more difficult aspect is by having the player jump on the head of the enemy, much like Super Mario. Can I implement a way for the player to die on contact with an enemy, but destroy the enemy if the player comes in contact with their "head"?
Comments
Another way to do this is to constrain an invisible actor ("enemy's head") and then do collision checks for the head and for the body separately. It would be a resource hog with so many actors, but that's what came to mind.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Make a game attribute named playerY. In the players actor put a constrain attribute and have self.positionY constrained to this game atribute. Make an actor (lets name it feet) and use a constrain Self.y to game.playerY minus half the actors height. Make the last actors height 2 to 4 pix, a little smaller width then the player actors and make it invisible.
Now in the enemy do a collision rule on the feet actor. In this you put whatever it does when hit on the head.
In the player actor you have your collision rule for when it hits the enemy and in it have what happens when you hit the enemy on the side.
What happens now is that when the player walks into an enemies side it gets hit / killed or wathever. When you jump on an enemie the actor doesn't hit the enemy but the feet do so the enemy dies.
Hope this makes sense. I have it in one of my prototypes and works flawless.
Cheers,
Ludwig.
Lump Apps and My Assets