[SOLVED] Film Grain/Noise

Started by DazJ, Sun 20/05/2012 19:41:08

Previous topic - Next topic

DazJ

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:

Code: ags

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?

Khris

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. :)

steptoe

#2
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:
Code: ags

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.


It's not over until the fat lady sings..

DazJ

The LockView is from the GUIAnimation module. I'll try it the alternative way with the button. Cheers guys :)

DazJ

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()

Code: ags

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


The GUI button is called BtnGrain. The animation of 3 'grain' frames is in View 6, Loop 0.

Khris

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.

steptoe

#6
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?
It's not over until the fat lady sings..

DazJ

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 :)

steptoe

It's not over until the fat lady sings..

SMF spam blocked by CleanTalk