Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: DazJ on Sun 20/05/2012 19:41:08

Title: [SOLVED] Film Grain/Noise
Post by: DazJ on Sun 20/05/2012 19:41:08
I've found couple of topics on this but none of them really explains what to do - unless I've missed one, plus I didn't want to micro-post on an old thread.

I'm wanting a full GUI overlay, with an animated background image of noise. I have between 3-5 images of noise that I have to overlay, with the correct GUI transparency of course.

The problem is, using the following in the Global script:


gGrain.Transparency=82;
gGrain.LockView(NOISE);
gGrain.Animate(0, 2, eRepeat);


overlays the transparent GUI and it looks great, but the problem is, there's just no animation.

What am I doing wrong?
Title: Re: Film Grain/Noise
Post by: Khris on Sun 20/05/2012 20:09:24
There's a GUI.Lockview and GUI.Animate function?
I couldn't find this in 3.2.1.

The only thing that supports a .LockView command is a character, is gGrain a character?
Or are you using an experimental build...?

Or maybe I have gone blind. :)
Title: Re: Film Grain/Noise
Post by: steptoe on Sun 20/05/2012 20:10:36
As with any animation you have to have a view or views.

I would probably use a transparent GUI and use a Button as large as the GUI and change its graphic to one of your images.

Make sure you have a View of images for your Button. Most people opt for PNG images.

When the GUI is turned on also set the button to Animate. It  should then Animate until you call an event to turn it or the whole GUI off.

Example:

gGrain.visible=true:   //GUI turn on
Bgrain.Animate(12, 0, 4, eRepeat);  //BUTTON turn on


Amend where needed.

Check out manual for animating object, buttons etc.

UPDATE:

Khris:

afaik LockView is character only. 

Quote
There's a GUI.Lockview and GUI.Animate function

Have not heard of these in 321.


Title: Re: Film Grain/Noise
Post by: DazJ on Sun 20/05/2012 20:25:41
The LockView is from the GUIAnimation module. I'll try it the alternative way with the button. Cheers guys :)
Title: Re: Film Grain/Noise
Post by: DazJ on Sun 20/05/2012 20:46:36
Still nothing. No animation. The first frame shows up but that's it.

I'm aware of the Animate function as I've already read the manual. However, it doesn't seem to work. Here's what I have in repeatedly_execute_always()


BtnGrain.Animate(6, 0,  4,  eRepeat);


The GUI button is called BtnGrain. The animation of 3 'grain' frames is in View 6, Loop 0.
Title: Re: Film Grain/Noise
Post by: Khris on Sun 20/05/2012 21:09:12
Don't call .Animate in rep_ex, it'll get executed 40 times per second, meaning the animation will start over and over again, never even getting to changing to the next frame.
Title: Re: Film Grain/Noise
Post by: steptoe on Sun 20/05/2012 21:20:32
As per Khris.

Like how often do you want the GUI with the Animate Button to show?

If it's only once or even a few times you could add the 'Button Animate' code too the Room Load.

Then when you open the GUI (make visible)  in that Room the Button should Animate.

Is there not a Global function for doing this yet?
Title: Re: Film Grain/Noise
Post by: DazJ on Sun 20/05/2012 21:27:26
Thank you gentlemen! Putting the code in the room_load function sorted it. I now have a grainy-film look which adds a boatload of atmosphere to the game :)
Title: Re: [SOLVED] Film Grain/Noise
Post by: steptoe on Mon 21/05/2012 07:55:37
Glad you got it sorted  ;)