Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: cipberbloom on Tue 03/11/2020 03:03:32

Title: Strange Object Animation Issue
Post by: cipberbloom on Tue 03/11/2020 03:03:32
Hiya, everyone -

I have an object in one room that is animating perfectly well with the following code:

Code (ags) Select

function room_Load()
{
oCat.SetView(3);
oCat.Animate(0, 3, eRepeat, eNoBlock);
}



In another, no animation occurs. Same code, with the View and Object IDs changed accordingly, as well as a different delay (the Torches animation is meant to be faster).

Code (ags) Select

function room_Load()
{
oTorches.SetView(4);
oTorches.Animate(0, 2, eRepeat, eNoBlock);
}


I've rechecked everything dozens of times with no change. Is there something simple I'm missing? Is this a bad way to code an object animation? BTW, there are no conflicting objects, nothing overlaps, no hotspots, walkable areas, nothing else there.

Thanks a million in advance.
Title: Re: Strange Object Animation Issue
Post by: Gilbert on Tue 03/11/2020 03:32:14
In the room's properties, events tab (the 'lightening' icon), check whether the function room_Load() is linked to one of the events, and type the name of the function in the script to link it to the desired event if it doesn't appear in the list (for room_Load() it's usually linked to 'Enters room before fade-in').

It is a common mistake to just copy contents from the script of one room to another without properly linking the functions to events of the room.
Title: Re: Strange Object Animation Issue
Post by: cipberbloom on Fri 06/11/2020 22:26:39
Thank you so much!  ;-D  Works a treat. :-D