Bonjour
Je suis entrain de crée un jeu dans lequel si on saute sur la tête de l’ennemis il prend un coup pour cela je crée une hit box mais je n’arrive par a que la hit box suive l’ennemi sur la tête
Quelqu’un a une solution pour que la hit box suive la tête de l’ennemi en continu ?
Bonjour, I don’t know French but I translated your question and I will try to answer your problem,
Normally you don’t need separated hitbox for your object as you can custom your hitbox by this
You put the hixbox and adjust it to match the head and make it smaller
this will result in perfectly fine as it always follows enemy head.
But if you do really want to make an object for hixbox and make it follows the head it’s also fine by doing this:
Make an action to match with the enemy position but in this case you may need to provide an id for the hitbox and enemy then have a condition if that id of hitbox match with id of enemy let do the below action
thank you but I may have forgotten to specify that if the player hits the enemy other than on the head he loses a life how to make a hit box on the head which gives damage to the enemy and another which gives damage to the player sorry I translated with google translate
Hello, I’m not 100% sure but for my solution
When normally you check if the player collide with the hitbox then do something
you add to the same block of condition to check if the player y position is higher or lower to the hit box or enemy
for example:
Condition
If player collides with hixbox / enemy
Add first sub condition below
If the player.pointY(“center”) is more than enemy.pointY(“center”)
then Action: player hurt (player.hp - 1 or anything)
Add another sub condition
If the player.pointY(“center”) is less than enemy.pointY(“center”)
then Action: enemy hurt (enemy.hp - 1 or anything)
*You may use other points than “center” like “origin” you have to be careful with the x y position