Mirror character walk to object too?

Started by Eric, Sun 04/03/2012 17:10:22

Previous topic - Next topic

Eric

I have a room with a mirror, a tiny room, in which I have a hole cut in a walk-behind through which the mirror character appears. I've put together code from a few sources on the forums, condensed, because my walk area is so small I don't really need to do extensive measuring from the bottom of the mirror to make the effect work (you can see a picture of the room in an image at the bottom of this thread).

Here's what I have:

function room_RepExec()
{
cFelixReflection.x=player.x+35;
cFelixReflection.y=player.y-20;

cFelixReflection.Frame = player.Frame;
 int l = player.Loop;
 if (l == 0 || l == 3) l = 3 - l;
 cFelixReflection.Loop = l;
}

I also have some objects in the room, for instance, a set of drawers, that the player walks to before opening, so:

player.Walk(oFelixDrawer1.X,oFelixDrawer1.Y,eBlock,eWalkableAreas)

When I interact with the drawer, the player walks to it as I'd hoped for. Unfortunately, the mirror character does not, and creepily stands there before disappearing once the drawer is opened. Any suggestions on getting mirror man to follow?

WHAM

#1
The walk is a blocking script and this keeps the Repeatedly Execute from working. Look in the manual for "repeatedly execute always" and try having the mirror script posted here in that instead. As far as I can understand that should work.

EDIT: Something like this in the room script
Code: ags

function repeatedly_execute_always() {
  cFelixReflection.x=player.x+35;
  cFelixReflection.y=player.y-20;

  cFelixReflection.Frame = player.Frame;
  int l = player.Loop;
  if (l == 0 || l == 3) l = 3 - l;
  cFelixReflection.Loop = l;
}

Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

Eric

Quote from: WHAM on Sun 04/03/2012 17:14:59
EDIT: Something like this in the room script

That works like a charm. Thanks very much!

SMF spam blocked by CleanTalk