Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: tor.brandt on Thu 20/10/2016 22:55:14

Title: [SOLVED] Is there a way to randomize the frames in a view?
Post by: tor.brandt on Thu 20/10/2016 22:55:14
I'd like to make my character's talking view play the frames randomly.
Is it possible e.g. to make a line in the global script that makes the talking view play out in such a way?
Title: Re: Is there a way to randomize the frames in a view?
Post by: Snarky on Thu 20/10/2016 23:01:37
Yes, it's possible, but not entirely straightforward. It would be much easier to just put a long random sequence of frames in the speech animation loop, and that's what I would recommend unless there's some very particular reason why it needs to be "truly" random.
Title: Re: Is there a way to randomize the frames in a view?
Post by: tor.brandt on Thu 20/10/2016 23:05:53
@Snarky:
Alright, thanks! I'll just do that then :smiley:
Title: Re: Is there a way to randomize the frames in a view?
Post by: Snarky on Fri 21/10/2016 15:10:28
All right, cool. If you're unhappy with the result, let us know and we can look into how to script a truly random animation.
Title: Re: Is there a way to randomize the frames in a view?
Post by: Crimson Wizard on Fri 21/10/2016 15:15:30
I think there are two ways, either to script timed animation yourself, locking character to particular view/loop/frames, or altering existing frames if you have have a premade loop for that. The latter can be achieved using Game.GetViewFrame and then assigning ViewFrame.Graphic to either existing sprite, or DynamicSprite.Graphic you created at runtime.
(Unfortunately there is no way to change the number of frames in loop though)