0 votes

My opponent only moves along the x-axis, that is, left and right, and bounces off the wall. I have such a problem, when a player collides with him, the player dies and is reborn, and the enemy continues to move, but from the fact that the player collides with him, he moves to another point of movement, that is, the opposite side of the collision bounces off the player, thereby colliding with other objects. How to fix it.

Godot version 3.2.3
in Engine by (19 points)

1 Answer

0 votes

I take it you want the enemy to keep patrolling even if it collides with the player?

Sounds to me like you have it set up so that your enemy is detecting collisions, and if it detects one then its direction changes, as to bounce off the wall.
In this case, you need to look at using layers and masks so that it will only detect collisions with those of the wall and not the player.

by (138 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.