Change web-gl effect?

0 favourites
  • 5 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • Can anyone give me a code to change a web-gl effect every x second.

    Example : Add blur effect to layout, and want to make the effect change all the time.

    On start of layout ---- ( Layout blur make it move between 1 to 9 ).

    Any help will be great

    Thank's

  • slanw

    There's probably a few ways to go about this, most likely some better ones from more experienced guys around here but this method works for me and doesn't require to many events..

    Firstly..

    Pick a Sprite on screen preferably on the layer you want to effect (just create a blank square and set invisble if you like) and add to it the "Sine Behavior".

    In the Sine Properties set Movement to "value only"

    Set everything to 0 cept' for Magnitude (100) and Period (say 2?)

    * you can play around with Magnitude and period for desired result..

    In events:

    Everytick > System-Set layer Effects Parameter > The layer, The effect, Index (0), then > "Sprite.Sine.Value"

    *replace 'sprite' .sine.value with your sprites name that you added sine to

    * You'll probably need to do this for Both Horizontal and Vertical but they can both run from the same Sine.Value.

    Hope that works okay for you..

  • Ometheu

    Thank's alot

    This is a smart trick and no need for many event's

    I'm searching for a way to make light and dark effect like " our darker purpose ' Game

    The game was made by construct 2,

    If you know how to make the same light effect, this will help me alot

    Thank's again

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here's a simple demonstration of one way I go about the lighting effect, this isn't lightweight, so just use how I have the layers blending in principal to apply to your own needs, I suggest you play around with layer 2's effect, hardlight, multiply etc will yield different results.

    Basically I have one layer on top of everything with a solid black background color (helps hides the edges of my sprite image), I set the layers effect to overlay, then I create a sprite on there with my light source image, generally a white circle with a fading to transparent radius. Lastly I change the sprites Blendmode to Additive.

    Plus search around the forum, There's probably a smarter, better and more performance friendly method out there

    ** Edit: Forgot to mention, use your arrow keys to move the light around on the attached example.

  • Sorry for the late replay

    This is awesome light effect Ometheu

    I will mix it with the sine method to get best result.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)