Javascript effect error

0 favourites
  • 8 posts
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • Hi, I'm currently trying to make a fast motion blur effect for my game

    Here is the fx's file code:

    // Motion Blur effect
    varying mediump vec2 vTex;
    uniform mediump sampler2D samplerFront;
    uniform mediump float quality;
    uniform mediump float seconds;
    function scrUpdater() {
    		mediump vec4 front = texture2D(samplerFront, vTex);
            gl_FragColor = front + oldfront*quality/100 ;
    void main(void)
    	if (seconds == 0){
    		mediump vec4 front = texture2D(samplerFront, vTex);
            gl_FragColor = front;
    	else {
    		mediump vec4 oldfront = texture2D(samplerFront, vTex);
    		setTimeout(scrUpdater(), 10);
    When I use it in Construct 2, I get this error:
    Can someone help me?
  • Looks like you are mixing C and JavaScript. 'function' is not a valid keyword, and I don't think setTimeout() is a valid call.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What should I put in its place?

    I've seen many tutorials like this one: (add in http)://

    They all use 'function'.

    Also, for the setTimeout() call, it doesn"t give me any error, and I've seen it here:

    (add in http)://

  • As far as I know effects use the 'OpenGL Shading Language' not Javascript. So javascript doesn't work here.

  • Asmodean Ah. Well that's a huge mistake I made!

    Thank you mate x)

    EDIT: Sooooo... I don't have a single chuking idea of how to translate this into OpenGL Shading Language. Can someone help me here?

  • Does the following Shader tutorial from gigatron help at all?

  • Mmh, I managed to get a motion blur to work, however this was absolutely not what I expected...

    I expected to get something like that: (https)://

    Or at least like that: (https)://

  • *moved to the more appropriate 'Effects' section

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