how do you subtract point from player only if it get hit
emoji
Member, BASIC Posts: 66
hello again everyone. how do I subtract point from the player if only the enemy punch or kick the player and not walk by and touch the player. I hope this question make sense
Comments
Do the subtracting in the enemies. If the enemy is punching the player AND overlaps with the player (or whatever condition is needed) then subtract a point.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
i though of the same idea was wondering if there are any other way but appreciated the response. I will work on it and if i have any question i will let you know.
What is it you're trying to do that makes you want a different way? There are other ways of handling it but what I described will normally be the best way. If you can provide some more details we can see if there's a better way for your use case.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
oh i didn't really mean it in a mean way. i have a player in a beat them up game and i have a box that the player follow (the box is a hit point) and whenever the enemy hit that box the player point would be subtract. i guess i can check if the enemy is colliding and punching the box is true. I appreciated the response. I haven't implemented yet. It not easy like it sound.
i have this but everytime my player punch the enemy, the enemy life would subtract more than one
You should use a Change Attribute instead of a Constrain Attribute.
Change Attribute game.enemy.score to game.enemy.score - 1
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
oh thank you very much it works
and if it's a combat game, consider using hit boxes for your collisions, that way you can make the collisions based on where proper contact is, rather than each time two entire sprites come into contact (see attached demo). left/right keys to move. space to strike.