Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: BowsetteGamer on Thu 12/12/2024 22:10:07

Title: How do I create a code to make a secondary character move constantly?
Post by: BowsetteGamer on Thu 12/12/2024 22:10:07
Hello guys, how are you, my secondary character, I configured it but he stays still, he doesn't move constantly.
Without the game freezing, that is, I put it on standby mode

(https://i.postimg.cc/WbP8zwYX/image.png) (https://postimages.org/)

6:05 PM I already solved the problem but I would like to know your opinion
Title: Re: How do I create a code to make a secondary character move constantly?
Post by: Rik_Vargard on Fri 13/12/2024 08:16:29
I use a timer for that:

SetTimer (1,80); // After Fade In

if (IsTimerExpired (1)) // in repeatedly_execute
{
 if (cChar.x == 1000) cChar.Walk (1200, 527, eNoBlock, eAnywhere);
 else cChar.Walk (1000, 527, eNoBlock, eAnywhere);
 SetTimer (1,120);
}

This way, I can also choose how long cChar will stay in place before moving again.