Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: theatrx on Sat 22/12/2007 06:38:21

Title: non player character mirror
Post by: theatrx on Sat 22/12/2007 06:38:21
This code works perfectly for the player character...


character[MYKAL].x=character[GetPlayerCharacter()].x;
michael_dist_from_mirror=character[GetPlayerCharacter()].y-mirrorbase;
mykal_dist_from_mirror=michael_dist_from_mirror/scale;
character[MYKAL].y=mirrorbase-mykal_dist_from_mirror;
character[MYKAL].loop=character[GetPlayerCharacter()].loop;
character[MYKAL].frame=character[GetPlayerCharacter()].frame;
}


is there a way to code this for a non playing character as in for a swan swimming on a lake?
Title: Re: non player character mirror
Post by: Gilbert on Sat 22/12/2007 08:13:17
Shouldn't it work automatically when you change all character[GetPlayerCharacter()] to another character?

Like:

cSwanmir.x=cSwan.x;
swan_dist_from_mirror=cSwan.y-mirrorbase;
swanmir_dist_from_mirror=swan_dist_from_mirror/scale;
cSwanmir.y=mirrorbase-swanmir_dist_from_mirror;
cSwanmir.loop=cSwan.loop;
cSwanmir.frame=cSwan.frame;
}

(with required varaibles like swan_dist_from_mirror and swanmir_dist_from_mirror defined of cause.)
Title: Re: non player character mirror
Post by: Khris on Sat 22/12/2007 10:16:01
Since the reflective pane is horizontal, it should be enough to set reflection.x to x and reflection.y to y-20 or something.
Title: Re: non player character mirror
Post by: theatrx on Sat 22/12/2007 22:23:30
Thanks Gilbot and Khris.  I ended up with this...

if (GetGraphicalVariable("Michael Walk") == 1) {
cMichael2.x=cMichael.x;
cMichael2.y=cMichael.y+50;
cMichael2.loop=cMichael.loop;
cMichael2.frame=cMichael.frame;
}

I needed this to happen only when he was in a certain area.
It seemed a little cleaner but I would have never gotten to this point without your help.  I keep forgetting that just because it's not there it doesn't mean you can't make an int to make it there... duh!!!

This is like the swan thing which is happening as well and also the player character at the same.  I still can't seem to make heads or tails out of the Lake Module but I'm working on it.  Thanks again.