0 votes

Hi guys,

so i'm making game about scp 173 and I am wondering how to create mechanic that stops player from moving before enemy is blinking.

I think I should use Timer, and area2d as an enemy vision but I have no idea how to write script for this, I watched some youtube tutorials but I have no idea how to make player stop when he's in enemy sight.

Does anyone have any ideas?

Godot version 3.4.4
in Engine by (15 points)

1 Answer

+1 vote
Best answer

Your code for controlling the player character should have some kind of speed variable that's multiplied with a direction vector that's determined by inputs. Simply connect a function that sets the speed to 0, to the signal that activates when the player's Area2D enters the Area2D for the visual field. You may have to experiment to see if

For blinking, you can change the visual field Area2D's collision layer or mask, depending on which area's signal you're using: https://docs.godotengine.org/en/stable/tutorials/physics/physics_introduction.html#collision-layers-and-masks

by (185 points)
selected by

Waiting for answer I was reading about raycasts and trying them, what do you think about this ? Will it be better?

by the way thank's for your answer :D

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 Frequently asked questions and 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 [email protected] with your username.