Components of an enemy in an aRPG

Hey,

so basically my question is: which components to use for enemies in a “diablo2”-like aRPG?

In more detail, i made some skills and currently can not decide how to set up the colliders for my GOs. I tried some stuff, but every solution is missing something. A few examples: I created an enemy with a boxcollider for hit detection and another circleCollider(isTrigger) for player detection with higher radius. If i use a projectile with a collider everything works fine, but if (for some reason) the player is hit by its own fireball he can “ride” on it, meaning it interacts with the playerGOs rigidbody. Setting the projectile collider to isTrigger fixes this, but now it collides with the circleCollider(isTrigger) on the enemy for player detection, which is not intended.
I mean i could write an if case for everything, but i would want a “clean” design if that makes sense… The documentation also does not give any clue on what the purpose of isTrigger colliders is. Am i using it wrong, when taking it for player detection? Should i do it somehow else? That would require to write some kind of particle in cell logic, like: the enemy has know all other enemies on the map to make some AI related decisions later on.

So yeah, how to set this up nice and clean? Thanks in advance :slight_smile:

You can use the physics2D in player settings to set up the collision matrix so player’s projectiles never collide with the player. Go to Edit>Project settings and then Physics2D

1 Like

Hey,

thanks for your reply! So the general approach is to manage these layers? For my projectile i would then do it like that: add a layer “player”, asign playerlayer (höhö) to player and its projectiles and then forbid player/player interaction in the layer matrix?

Essentially yeah. I would have a “Player”, “Projectile”, and maybe even a “EnemyProjectile” layer. Then you go to the matrix and would uncheck the player and projectile one.

thanks again, i was missing this feature and could not imagine to handle this in any sane way

1 Like