I'am still pretty new to construct so sorry if the answer is obvious to you guys but I have been searching my ass off trying to find an answer. I have read the tutorials and I found alot of people who have been asking almost the same kind of question but I can't really work it out in my own project.. I just don't seem to understand it :(
In my project I have got a lot of sprites that are the visitors of a festival, these visitors have got instance variables like thirst, hunger, toilet. When these variables reach <= 5 they go to the toilet, bar or where ever they need to go to get this variable replenished. This works great, only problem is that they do not go to the nearest but to the first one created.
I have tried to use the pick nearest option, but they still go to the first placed(wich is the furthest)..
Hope you guys can help me!
Develop games in your browser. Powerful, performant & highly capable.
Your events should look something like this:
Every 1 second
Character Pathfinding not moving
For each Character
Bar pick nearest to Character
Character find path to Bar
Character on path found
Character move along the path
If this doesn't help, please post your project file or code screenshot.
Thank you for the quick response! I will try this as soon I get home from work!
dop2000 This is how I have tried to make it work, but it doesn't. Would you please take a look at the code in the capx? Thanks in advance!
It seems to work fine for me. If you create several stage sprites, you will see that bezoerkers are moving to the nearest stage.
What you need to do is remove all "Trigger once" conditions from all events in your code! Don't add this condition to "For each" loops, or when dealing with multiple object instances. It can cause all kinds of bugs when used incorrectly.
YESS!!! Thank you so much!!
It works now :)
You are awesome!