Characters on the same XY coordinate (SOLVED)

Started by EnterTheStory (aka tolworthy), Fri 28/12/2007 18:00:30

Previous topic - Next topic

EnterTheStory (aka tolworthy)

It looks like AGS has primitive collision detection built in all the time, that is, two characters cannot occupy the exact same xy location. Is that true?

Sometimes when characters are on or near the same point, first one is in front, then the other, then the first again, etc. So the costumes seem to flash as they rapidly change. Has anyone else seen this flashing? If so, any ideas on how to avoid it?

monkey0506

I'm not sure how it might play out, but have you tried using the Character.z property?

Code: ags
cNPC1.x = 120;
cNPC1.y = 100;
cNPC1.z = 0;
cNPC2.x = 120;
cNPC2.y = 101;
cNPC2.z = 1;


Never used Character.z myself, but something like this may solve the problem. Or it might just cause the exact same problem. :=

EnterTheStory (aka tolworthy)

#2
Quote from: monkey_05_06 on Fri 28/12/2007 18:20:41
I'm not sure how it might play out, but have you tried using the Character.z property?

It's definitely an idea. Though I'd have to constantly check if other characters were close by - I often have five or ten characters trying to walk through the same point.

Character.z would be a great solution to a related problem that just arose: I have two crowds that walk "through" each other. It looks neat, except when they touch and stop. Character.z would be a good solution, but like a fool I designed the scene so the crowds are travelling exactly along the Y axis, and changing it now would be a huge job.

Ir's amazing how a very simple piece of code (two characters walking together) can quickly become very complicated. It takes two minutes to write and two weeks to bug-fix!

Gilbert

Hmmm, are "solid" checkbox checked for the characters (I think that's the default setting)?
Try unchecking the "solid" boxes and see if it makes any difference.

EnterTheStory (aka tolworthy)

I haven't checked. I'll have a look. Though it only seems to happen if they occupy the exact XY coordinate - they often brush past each other in a way that the transparent areas must surely overlap.

Radiant

Two characters can occupy the same coordinate just fine, but this may play havoc with their display priority.

This begs the question why you are putting two characters in the same spot to begin with.

One solution is to use FollowCharacter() to display one character on top of the other.

Another is to put one a few pixels below the other, and adjust the sprites to compensate.

Another is to give one character a Baseline a few pixels lower.

EnterTheStory (aka tolworthy)

Quote from: Radiant on Sun 30/12/2007 20:51:45
This begs the question why you are putting two characters in the same spot to begin with.
I don't - they have minds of their own. :) I have 20-40 characters walking almost randomly, and they seem to develop minds of their own - always hunting out the narrowest part of any walkable area, then standing around in tight groups so nobody else can get past. Or that's what it looks like anyway. They do separate eventually. Maybe they're just friendly.
.
Anyhow, thanks for the suggestions. I've marked this thread "SOLVED" not because I can get the blighters to do what I want, but because I have enough insights now (thanks to you guys) that I don't feel quite as helpless as before.

SMF spam blocked by CleanTalk