Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to "Go to a clone" and Path Finding?
- Brandon179
- New to Scratch
5 posts
How to "Go to a clone" and Path Finding?
I'm making a zombie game.
But when i create a clone of the zombie sprite that moves the same way, the other sprites that are used as hitboxes don't also follow the clones of the original zombie. Is there any way to have the sprites also follow clones?
Also i would like it so zombies don't just run into walls when they are following the player. I want them to find the shortest path around obstacles to the player with out really following a grid (if possible) .
But when i create a clone of the zombie sprite that moves the same way, the other sprites that are used as hitboxes don't also follow the clones of the original zombie. Is there any way to have the sprites also follow clones?
Also i would like it so zombies don't just run into walls when they are following the player. I want them to find the shortest path around obstacles to the player with out really following a grid (if possible) .
- Kenichi10B
- Scratcher
74 posts
How to "Go to a clone" and Path Finding?
Can't really help with pathfinding, but I can help with going to clones. When the clone starts, give each clone a seperate ID, and have a list with their positions. Update that list and you can make a different sprite going to positions in the list. I made a project for someone else showing what I just said, here's the link: http://scratch.mit.edu/projects/21229709/. Hope it helps!
- drmcw
- Scratcher
1000+ posts
How to "Go to a clone" and Path Finding?
I'm afraid the problem is too general for someone to help you. That sort of AI will be very game specific and so no one can really come up with a general solution for you. You've already added a constraint of no grids which doesn't help. I can only provide 2 suggestions; Bump
Please help!
1) Look at all the tower defense type games as they typically implement a path finding algorithm, you may find something suitable there you can use
2) Start simple e.g. point towards player then move, if touching obstacle then turn random left or right. Then add more cases to that to make it more “intelligent”
- Discussion Forums
- » Help with Scripts
- » How to "Go to a clone" and Path Finding?