#(Resolved) How to get enemies to stop clumping together.

26 messages · Page 1 of 1 (latest)

urban fulcrum
#

I finished the vampire survivors tutorial video, and when I played the game most of the enemies clump together like this. How would I keep the enemies outside of each other?

eager cipher
#

One way would be to give them collision boxes to keep spaces between them. This is probably the simplest way.

#

This tutorial covers a different way you could deal with clumping.

solar shadow
#

give them collision boxes and makee sure the collisionbox layeer and mask match so that they can notice each other. It would probably help if the enemies are characterbody2d (at which point a collisionbox is reequired)

#

the vampire survivor tutorial should actually cover this problem of them clumping together

urban fulcrum
#

How do I check if they the collision box layer and mask match?

solar shadow
#

nvm, you need to handle collision in the characterbody2d node. There, in the inspector go to "collision", and make sure that they are on a layer and that the mask also covers that layer. Didn't the vampire survivor tutorial also cover this? I thought it did

urban fulcrum
#

The layer and mask are the same.

#

They still collide though.

#

Nvm, they are on a different layer. The tutorial said to do that though?

solar shadow
#

depends on what you ant to achieve. If you put them on a different layer, you can target them specifically or you can make it so that they can't interact (example, if you want flying opponents to not collide with ground-moving opponents, you could make layer 2 be opponents and layer 3 be flying opponents, and then adjust the masking so that both mask layer 1 with the player, but only "normal" opponents mask layer 2 to collide with other "grounded" opponents, while flying opponents mask layer 3 but not 2 so they collide with each other and the player, but not the "ground" opponents

urban fulcrum
#

I only have ground opponents

solar shadow
#

So basically:
Layers - I'm here
Mask - I can see (and collide with) you

#

they need to see each other to know they're here

#

that's why they need to be the same

urban fulcrum
#

I'll play around with it and see what works.

solar shadow
#

iirc, in the tutorial you move opponents to layer 2 so that the bullet doesn't collide with the player (so that the bullet can only mask the enemy layer and doesn't need to mask the player layer)

urban fulcrum
#

I changed the enemy to be on the same level, now the auto-aim is broken.

solar shadow
#

uh, iirc it's supposed to be something like this:
Player layer: 1
Player mask: 1, 2
Opponent layer: 2
Opponent mask: 1, 2
Bullet layer: none
Bullet mask: 2

#

If it's like this, it should work: Both the player and the opponents can see each other, but the bullet can only see enemies

urban fulcrum
#

Thank you so much!

#

I realized that my main issue was I mistook collision and visibility. I had visibility open so I was changing the mask and layer there, not on the collision tab.

#

Is there a way to "resolve" the issue, or do I just leave it like this?

solar shadow
#

ye, you can change the title of the post and put (resolved) in front

urban fulcrum
#

alright