The Godot Community Forums are back up and running! Please read the the announcement post for important information on what happened. Thanks!

Enemy AI is Ignoring Engine.time_scale

UnknownUserUnknownUser Posts: 0
edited September 16 in Programming

First, this is from player's script:

if motion == Vector2(0,0):
    Engine.time_scale = 0.05

And here, from enemy script:

var player = get_parent().get_node("Player")

if can_chase == true:
    position += (player.position - position)/50

I don't know why the enemy keep chasing the player with full speed. It supposed to slowdown just like rigidbody2D in the scene.


  • TwistedTwiglegTwistedTwigleg Posts: 3,141Admin

    (Fixed code formatting in OP)

  • vmjcvvmjcv Posts: 45Member

    In your code ,the position's update is not directly related to time update
    maybe you can change the code like this
    position += (player.position - position)..normalized()speeddelta

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file