Since dragging each NPC graphic to each NPC and saying, “at beginning of scene, if graphic is in collision with actual NPC, go stand in the center of the NPC object,” would be a lot of work, I want to just drag NPCs where I want them, and then at the beginning of the scene, they already have their graphic (the actual person-image) standing in the middle. So I did this:
Hi,
your for each events work, the problem are the condition-less events below, because all the playerHolo and NPCHolo objects are changed to the position of one of the player or NPC objects.
There are two solutions:
The easy one: just use the sticker behavior and stick the …Holo-objects to the player/NPC object. Both objects will move together and you don’t need any extra events for that.
The more tricky one: use the ‘link two objects’ action and condition. Here the sequence of linking the objects is important. Linked Objects - GDevelop documentation The wiki shows an example and you can also find some forum topics which explain that.
Oh, wait. No. Now, the objects aren’t stuck on the NPCs. It worked perfectly well for the player, which uses the exact same formula, but for the NPCs, the holos (holograms, since it’s just an image of representation, rather than the actual thing) don’t follow their linked NPC’s position.
It says, at the beginning of the scene, for each object of NPC, create NPCHolo at the centerpoint of NPC, and then link the two objects, immediately after.
Oh, and my player only worked because I had set the playerHolo’s position to the player’s position elsewhere, but that only works for singular objects, like the player.
I was using the top one, minus whatever that loose, bottom event was, but I just converted it to sticker. That works for now, but I wonder if it might stick to the wrong NPC in a crowded area, or stick NPCs together by mistake.
It won’t. You are iterating over each NPC object and creating a new NPCHolo that is then stickered to it. That sticker action only applies to the current NPC object and the newly created NPCHolo. All other NPC and NPCHolo objects are not in scope at that point.