I have a collision with physics applying random damage between two objects I commented as ‘Body on Body’ working as intended: Adjusting a global variable, reprinting the resource bar, and dropping a blood object. (Screenshot added). Then moving away from the collision.
In the Section ‘Head on Body’ I’d like to selectively have ‘Head’ objects deal damage to the enemy when the player head object is colliding with an object group called ‘Bodies_Legs’.
When enabling the ‘Head on Body’ events to select heads linked to the player and deal this damage, the head is seemingly being selected correctly, but the damage and resource bar actions are not working correctly, though the blood action is - repeatedly.
What’s more, any trigger of the first ‘body on body’ event seems to be quickly looping and broken. With the HP variable quickly dropping to 0 and triggering the end state.
Disabling ‘Head on Body’ section makes ‘Body on Body’ work as intended again.
The two collision tests are at the same level under the Attack Each Other Group.
Any help would be greatly appreciated.
I wonder if the bottom section is creating a loop where it’s pushing or pushing with angle into the player into the enemy causing the collision to be triggered which again pushes/rotates the player into the enemy and so on.
I disabled the ‘dodge’ movement actions in the head on body section and behavior still broken.
Definitely some kind of loop because create blood object being triggered by head repeatedly - but not the damage.
Damage being triggered repeatedly by body on body - but only while head code enabled…
Which part did you disable? Can you post a pic of the scene so we know what you’re separating?
Am I reading this correctly? First it separates the player and enemy and then it adds an impulse in a random direction with a random length of either to, away or nothing.
Sorry for delay, busy week.
I disabled the “Head on Body” section completely and it works as intended.
Attaching video links of intended behavior before new code added and after - excuse the testing sprites.
First video - bodies collide, do ‘damage’, health bars work, randomized motion creates movement like dodges and circling.
Second video - head on body collision triggers blood but not ‘damage’ variable, body on body contact creates high damage for object without head instead of normal amount.
For clarity the whole ‘Head on Body’ section has been disabled in first video - and variables changed so no head & legs added at all.
Head and legs are physics objects welded to body object.
I don’t know what’s wrong. I’m a little curious about the damage in the top part.
It’s picking a random number,
If it’s <0 the player loses health
If it’s > the enemy loses health
If it’s = 0 then the player loses heath twice.
Ack, that is in error. That should be both take damage, not twice to player.