GameMaker: Studio

GameMaker: Studio

Statistiche:
A* pathfinding (mp_grid) question
I am using the A* pathfinding algorithm using the mp_grid function, but I have noticed that if the path becomes blocked, the enemies using the path disappear. So if they can't follow the path, the games destroys their instance. Why does game maker destroy them rather than just having them stop in place? Is there a way I can keep them from getting destroyed?

I have checkes to keep the path from getting blocked, but sometimes I want the player to be able to block the path for a few moments, and I want the enemies to stand in place until the path opens back up. But they are instantly destroyed.....

Can anybody shed some light on this for me?
< >
Visualizzazione di 1-6 commenti su 6
Idk, since you're using someone elses library. But you could clone the pathfinding object and have the enemy follow a pathfinding object precisely. That way, when the path is destroyed the enemy would stop (since it has no target to follow)
mp_grid functions do not destroy the instance when the path is blocked, the instances following the path should simply stop. It's likely that somewhere in your project there is code that causes them to destroy on path end and the path is ending early due to it becoming blocked.
Ultima modifica da Daynar; 9 ott 2015, ore 20:07
Messaggio originale di Daynar:
mp_grid functions do not destroy the instance when the path is blocked, the instances following the path should simply stop. It's likely that you have code that causes them to destroy on path end and the path is ending early due to it becoming blocked.

Interesting idea.... i've implemented the pathfinding several different ways using the mp_grid functions, and it destroys them when the path is blocked no matter what. I'm pretty sure I don't have any code that destroys them when they don't have a path, but I'll take another look at my code to see if that is somehow happening. Thanks.
It happened to me a few times as well, not sure why.
Alternativly it could be teleporting them offscreen depending on your path settings. (I think)
Messaggio originale di Daynar:
Alternativly it could be teleporting them offscreen depending on your path settings. (I think)

I'm inclinded to think that's it's more along these lines. I'll have to do some debugging to look for enemy instances outside the room. Good idea!
Ultima modifica da DirectOrder; 10 ott 2015, ore 8:43
< >
Visualizzazione di 1-6 commenti su 6
Per pagina: 1530 50

Data di pubblicazione: 9 ott 2015, ore 20:01
Messaggi: 6