Move enemy towards player
Asked Answered
E

1

0

Hi, so i want to move the enemy towards the player but i don't know how to do it. I have a world scene, a player scene and an enemy scene.
Thats my code:

Eonian answered 11/11, 2023 at 21:29 Comment(0)
S
1

Eonian Each frame take player's and enemy's positions and then use Vector2::move_toward() to calculate enemy's new position that's nudged towards the player.

Subdominant answered 11/11, 2023 at 21:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.