Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: bx83 on Thu 29/07/2021 11:19:48

Title: Animated inventory items
Post by: bx83 on Thu 29/07/2021 11:19:48
Can you, and if so, how do you make one of these?
There is an older plugin for it; but no .SetView for inventory items, and I'm not sure if it's even possible n 3.5.x?
I'm looking for the easiest way to attach a single ~10-frame loop, repeated, to an item which displays constantly when the inv window's on screen; that's all, nothing fancy.
Title: Re: Animated inventory items
Post by: Slasher on Thu 29/07/2021 12:14:19
Have you tried the InvItemAnimation module?
Title: Re: Animated inventory items
Post by: bx83 on Thu 29/07/2021 12:23:32
Does it work in 3.5.1.8? Because it was made in 2005.
Title: Re: Animated inventory items
Post by: Slasher on Thu 29/07/2021 12:33:02
Quote from: bx83 on Thu 29/07/2021 12:23:32
Does it work in 3.5.1.8? Because it was made in 2005.
I know It works with AGS Editor .NET (Build 3.5.0.26)

You can but try  (nod)
Title: Re: Animated inventory items
Post by: fernewelten on Fri 30/07/2021 12:12:14
I've just looked into the code (the version I have is 0.91). It seems to have been converted to the "modern" object oriented calls, so I don't see why it shouldn't work.

Its main implementation idea is to keep an internal array of views, one for each inventory item, and loop through the inventory items in each game cycle.
In each loop cycle, check whether the item should be animated. If it should, replace the inventory item "Graphic" by the appropriate frame of the appropriate view, as stored in the internal array.

In addition to the inventory image, items also have a cursor image. This is not going to animate.

It might be a good idea to arrange things so that animations only run whenever the user can see them, i.e., whenever the inventory is shown ("PauseAll()", "ResumeAll()").