Switching Characters and Camera Tracking

Started by KodiakBehr, Sun 27/01/2013 21:48:43

Previous topic - Next topic

KodiakBehr

Hey guys,

Can you give me some insight as to what is happening here?

I've got a scene where the player, upon crossing a specific point, has his/her attention moved from the protagonist to another character.  Basically, I want the camera to track a new person in a cutscene as they walk a brief path, an event occurs, and then the camera returns to the original player.

The switch appears to happen, but the camera fails to track the new player and all the good stuff appears to be happening off-screen!  Any idea what I can do to remedy this?

Code: AGS

function region5_WalksOnto()
{
    region[5].Enabled=false;
    player.StopMoving();
    odoor.Animate(0, 2, eOnce, eBlock, eForwards);
    cCharacter2.SetAsPlayer();
    player.Walk(1497, 126, eBlock, eAnywhere);
    player.Walk(1262, 126, eBlock, eAnywhere);
    player.Walk(1262, 178, eBlock, eWalkableAreas);
    player.Walk(1054, 177, eBlock, eWalkableAreas);
    player.Walk(1053, 128, eBlock, eWalkableAreas);
}

selmiak

How do you know the switch is happening when you can't see what is happening with cCharacter2? But I just used the same approach for a cutscene and it worked just like intended, though I refer to the new player charater by cCharacter2.Walk(... instead of player.Walk(... but that shouldn't matter.
I see nothing wrong with your code, but to track some more of the offscreen happenings (maybe there is something wrong with what is happening off screen, but it doesn't look wrong at all), have you tried setting the viewport with SetViewport(x, y)?

KodiakBehr

Viewports.  You learn something every day.  Thanks!

Khris

The camera should be following the current player character, without you having to call Viewport commands.
What happens if you add "Wait(1);" after the .SetAsPlayer() command?

KodiakBehr

That seemed to do the trick.  Thanks Khris.

SMF spam blocked by CleanTalk