Overlays and such

This forum is currently in read-only mode.
  • Hi there!

    First of all, let me just say Construct ROCKS. After 10 years of bugs on MMF/TGF/CNC I'm loving this program. Thanks!!

    Ok, what I want to know, is if is there any way to put an effect directly to the whole game screen?

    I made this little basic game, and put rain on it, and I want a thunder to happen from time to time. The most basic way of doing that, since I come from MMF, is to draw a white block on a layer above the main one, and generate a random number, so when the generated number hits, let's say, 10, the thunder happens.

    Also I'm playing with the opacity, so the screen slowly goes back to normal.. but the thing is, just for that, I'd need lots of lines and at least 2 variables.

    So, is there any way of using the effects on the whole screen, so I can just overlay it with white, and slowly turn the overlay effect off?

    Thanks !

    Here's the game (without the thunder)

    http://sites.google.com/site/usonic/her ... ects=0&d=1

    (also I've been reading around the forums and found that blurry pixelated characters is an common problem, is that correct?)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want to fill the screen with white just add a layer with a non-transparent (white) background on top of everything, and adjust its opacity in events. To process a shader on the full screen, create a window-sized Canvas, enable 'grab layout before drawing', and add a shader to the canvas object.

    By default Construct uses linear sampling, which is a way of smoothly rotating and stretching sprites, but its well known side effect is pixelly sprites at floating-point positions look slightly blurred. To restore pixelly movement, rotation and stretching, set sampling to Point in application properties.

  • If you want to fill the screen with white just add a layer with a non-transparent (white) background on top of everything, and adjust its opacity in events. To process a shader on the full screen, create a window-sized Canvas, enable 'grab layout before drawing', and add a shader to the canvas object.

    By default Construct uses linear sampling, which is a way of smoothly rotating and stretching sprites, but its well known side effect is pixelly sprites at floating-point positions look slightly blurred. To restore pixelly movement, rotation and stretching, set sampling to Point in application properties.

    Thanks for the fast response! Going to try that right now.

  • For fading the object out smoothly, you could use lerp, that way'd you'll only need two events:

    random(x) -> Set LayerOpacity to 100
    If LayerOpacity > 0 -> Set LayerOpacity to lerp(LayerOpacity,0,1-0.0001^TimeDelta)[/code:1u9pawev]
    
    The smaller you make the 0.0001 part the faster the fadeout will be. One another way to speed up the fadeout would be to do this:
    
    [code:1u9pawev]Set LayerOpacity to lerp(LayerOpacity,-100,1-0.0001^TimeDelta)[/code:1u9pawev]
    
    By changing the target opacity from 0 to -100 in the lerp you'll speed up the time required to hit 0.
  • For fading the object out smoothly, you could use lerp, that way'd you'll only need two events:

    random(x) -> Set LayerOpacity to 100
    If LayerOpacity > 0 -> Set LayerOpacity to lerp(LayerOpacity,0,1-0.0001^TimeDelta)[/code:35yon0z6]
    
    The smaller you make the 0.0001 part the faster the fadeout will be. One another way to speed up the fadeout would be to do this:
    
    [code:35yon0z6]Set LayerOpacity to lerp(LayerOpacity,-100,1-0.0001^TimeDelta)[/code:35yon0z6]
    
    By changing the target opacity from 0 to -100 in the lerp you'll speed up the time required to hit 0.
    

    I get it.. this is much better than the way I was using, thanks !

    Just one question, in the part where you said "random(x)", let's say I use "random(10)", does this means that the layer opacity will go to 100 when the random number reaches 9? I don't understand much of the "random" function

    Or should I create an event to generate a random number each 1000ms, and then use "if numer = 9 -> set layer opacity to 100" ?

    Thanks again, that was really helpful, the way I was doing it was kinda buggy.

  • [quote:25iali9h]I don't understand much of the "random" function

    Look at it this way:

    If I tell Construct random(6) then every time it reads that it's going to roll a six-sided die. (The numbers on the die are 0, 1, 2, 3, 4, and 5.)

    If I tell Construct random(473) then it will roll a 473-sided die.

    You can use this for comparisons.

    System: Compare: random(10) is equal to 1.[/code:25iali9h]  Construct will roll every tick, and on every tick that 1 pops up, the event will trigger.  I believe this is what Daiz was meaning in his post, he just wrote in shorthand.
    
    You can use it in other expressions too, like actions.
    
    [code:25iali9h]+ Always
        -> Sprite: Set X to random(640) + 1[/code:25iali9h]
    
    Every tick the sprite will set it's x position somewhere between 1 (because of the +1) and 640.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)