Hi all, this is a serious noob question as I just started using AGS a month ago on my first point and click game.
I am trying to animate a drawer to open and close. I made the drawer sprites for closed, mid, open. I made a view for the animation. I got the drawer to be an object and successfully made an interaction where it will open, however when I go to click it closed it just runs the open animation again :confused: . I followed the example from Julia Minamata's video https://youtu.be/S4mYv_Okzx0?si=_ovgfD94w9ZEbJFM&t=1952 Making The Crimson Diamond... LIVE! Adventure Game Studio Basics at 32:32.
I read the manual, searched the forums, and I just can't seem to get my drawer animation to close.. I am probably doing something exceptionally obvious and stupid but any help would be welcome. Thank you in advance.
Ok, the code:
-------------
oDrawer is my object
The View is 1. Loop is 0. Closed is frame 0, mid frame 1, open frame 2
cLux is my main character
-------------
function oDrawer_Interact()
{
cLux.Walk(140, 140, eBlock, eWalkableareas);
oDrawer.SetView(1);
if (oDrawer.Frame==0)
{
oDrawer.Animate(0, 15, eOnce, eBlock, eForwards);
}
else
oDrawer.Animate(0, 15, eOnce, eBlock, eBackwards);
}
Is this happening because I am using AGS version 3.6.2?
I see in the Object.SetView section of the help manual that now (since AGS 3.6.0) SetView resets the loop and frame to 0, but I want to use SetView to name the view whether the drawer is open or closed.
Quote from: AnthonyMeza on Wed 27/08/2025 05:50:32I see in the Object.SetView section of the help manual that now (since AGS 3.6.0) SetView resets the loop and frame to 0, but I want to use SetView to name the view whether the drawer is open or closed.
Call SetView with Object.Loop and Object.Frame to keep the current loop and frame:
oDrawer.SetView(1, oDrawer.Loop, oDrawer.Frame);
Also, don't use literal View numbers, use View names. For every view you make there's a capital-case VNAME is script.
For example:
oDrawer.SetView(VDRAWER, oDrawer.Loop, oDrawer.Frame);
This way you dont have to memorize these numbers.
wow, thanks so much. that worked!