#I can only slide one enemy in platform when both are walking on the platform
1 messages · Page 1 of 1 (latest)
You should really add debugs and work out why they do this. Or just look at your code and think about this logically, under what conditions are you starting the coroutines?
When the tag is Player and isSliding is false
Do you see why your code fails to slide both at the same time after going through it step by step?
oh reason must be when one of them walks, issliding is true and because other one cant slide
I added that because it was starting coroutine over and over again
Yes, so the logic is a bit flawed because you've coded it so only 1 slides at a time.
Theres different ways to solve this, like store which object is currently sliding in a list and remove it after sliding is done.
Or move some of this logic to the enemy script and have each enemy just handle the state themselves
Im sure some people would choose one way or the other depending on how strictly they like to structure their game
I thought of the last one but just deleted isSliding worked for now
That might cause you more issues if an enemy starts sliding multiple times
platform is not very big so it doesnt slide one more time
If you add more colliders or stuff to the player you might face it, I face this issue a ton because i use ragdolls with like 14 limbs so each one will try to trigger an effect.
I mostly just let the world objects deal with it and store what they're currently affecting in a list
noted
I use capsules as enemies right now when I use real enemy models that can be a problem