Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Postmodern Adventures on Fri 17/07/2020 18:29:04

Title: My NPC´s turn around
Post by: Postmodern Adventures on Fri 17/07/2020 18:29:04
I have several NPC walking some left to right and others right to left with this code in repeteadly_execute:

Code (ags) Select

if (!ctrans01.Moving)
{
    if (ctrans01.x < 200) ctrans01.Walk(400, 162,  eNoBlock, eAnywhere);
    else ctrans01.Walk(-100, 162, eNoBlock, eAnywhere);

}


And i have the problem when i change room and turn back to the room with the people walking, some of them just turn around. Here´s a video:



Is there any way to prevent this?



Title: Re: My NPC´s turn around
Post by: eri0o on Fri 17/07/2020 18:42:59
I imagine once you change room they all stop moving, so once you come back, they start moving again because of your if condition. It's probably best to use the instant fadeout/fadein and instead tween the transparency of a fullscreen empty GUI with black background, so people start walking again before the black transition happens.

Edit: alternatively instead of anywhere, use a specific location and make people keep walking the direction they were going?
Title: Re: My NPC´s turn around
Post by: Postmodern Adventures on Fri 17/07/2020 23:43:27
Based in your idea i tried to do a simple thing. I preload a fullscreen black object and a View with progressive transparency animation (eNoblock)  to zero. While this happens, NPC turns around and the player doesn't notice it.

I know it''s not an elegant solution,  but something like that it's what i looking for. So, thanks Eri0o for the suggestion. You saved my day.
Title: Re: My NPC´s turn around
Post by: eri0o on Sat 18/07/2020 01:13:47
I try to craft good systems for tools but I fully believe a game is collection of hacks that ships.
Title: Re: My NPC´s turn around
Post by: arj0n on Sat 18/07/2020 12:01:44
Hacks aka workarounds  ;)
Title: Re: My NPC´s turn around
Post by: KyriakosCH on Sat 18/07/2020 14:25:47
Quote from: eri0o on Sat 18/07/2020 01:13:47
I try to craft good systems for tools but I fully believe a game is collection of hacks that ships.

Of course. Or at any rate it's what I do - abusing regions/items/other as triggers  (laugh)