Discuss Scratch

Nukeling73764
Scratcher
2 posts

Pathfinding

I need some help with pathfinding. What I'm going for is a maze with an enemy AI that roams through the halls when not chasing the player, and when the player goes into its sight, it will start chasing the player, and if the player goes around corners, the enemy AI will follow them while chasing them. If the player goes around enough corners, or in a closet, the enemy AI will lose track of the player and start roaming the maze again, and do it again when the player is in its sight. could someone help me out please? Here is the link to the project so you know what I'm working with https://scratch.mit.edu/projects/1011246236/ . Also, please don't add a like, and don't add a favorite, I am asking for help, not fame. Thank you!
checkpoint23
Scratcher
50 posts

Pathfinding

The best solution is to you raycasting, which I am not familiar with. If you could make invisible lines, that detect walls and of course, the player, it would work fine. I think you should watch a few tutorials on scratch raycasting first though.
n-clue
Scratcher
100+ posts

Pathfinding

checkpoint23 wrote:

The best solution is to you raycasting, which I am not familiar with. If you could make invisible lines, that detect walls and of course, the player, it would work fine. I think you should watch a few tutorials on scratch raycasting first though.
that will not solve the problem, that will detect if the player is in view, but not pathfind to it

Last edited by n-clue (May 3, 2024 05:21:20)

n-clue
Scratcher
100+ posts

Pathfinding

Nukeling73764 wrote:

I need some help with pathfinding. What I'm going for is a maze with an enemy AI that roams through the halls when not chasing the player, and when the player goes into its sight, it will start chasing the player, and if the player goes around corners, the enemy AI will follow them while chasing them. If the player goes around enough corners, or in a closet, the enemy AI will lose track of the player and start roaming the maze again, and do it again when the player is in its sight. could someone help me out please? Here is the link to the project so you know what I'm working with https://scratch.mit.edu/projects/1011246236/ . Also, please don't add a like, and don't add a favorite, I am asking for help, not fame. Thank you!
ive made a remix of your project using my solution, basically if the enemy sees you, it goes into chase mode, if its in chase mode and it cant see you anymore, it will go to the last place it saw you
checkpoint23
Scratcher
50 posts

Pathfinding

n-clue wrote:

checkpoint23 wrote:

The best solution is to you raycasting, which I am not familiar with. If you could make invisible lines, that detect walls and of course, the player, it would work fine. I think you should watch a few tutorials on scratch raycasting first though.
that will not solve the problem, that will detect if the player is in view, but not pathfind to it
I imagine it wouldn't be too hard to code moving to the plsyer but ok.

Powered by DjangoBB