Mikal's Forum Posts

  • Example of denorm and clamping.

    /////////////////////////////////////////////////////////
    // Barrel
    
    //The current foreground texture co-ordinate
    varying mediump vec2 vTex;
    //The foreground texture sampler, to be sampled at vTex
    uniform lowp sampler2D samplerFront;
    //The current foreground rectangle being rendered
    uniform mediump vec2 srcStart;
    uniform mediump vec2 srcEnd;
    //The current foreground source rectangle being rendered
    uniform mediump vec2 srcOriginStart;
    uniform mediump vec2 srcOriginEnd;
    //The current foreground source rectangle being rendered, in layout 
    uniform mediump vec2 layoutStart;
    uniform mediump vec2 layoutEnd;
    //The background texture sampler used for background - blending effects
    uniform lowp sampler2D samplerBack;
    //The current background rectangle being rendered to, in texture co-ordinates, for background-blending effects
    uniform mediump vec2 destStart;
    uniform mediump vec2 destEnd;
    //The time in seconds since the runtime started. This can be used for animated effects
    uniform mediump float seconds;
    //The size of a texel in the foreground texture in texture co-ordinates
    uniform mediump vec2 pixelSize;
    //The current layer scale as a factor (i.e. 1 is unscaled)
    uniform mediump float layerScale;
    //The current layer angle in radians.
    uniform mediump float layerAngle;
    
    //effect.fx
    precision mediump float;
    
    uniform mediump float scale;
    
    void main(void)
    {
     mediump vec2 n = (vTex - srcOriginStart) / (srcOriginEnd - srcOriginStart);
    
     vec2 st = n - 0.5;
     float theta = atan(st.x, st.y);
     float rad = sqrt(dot(st, st));
     rad *= 1.0 + scale * pow(rad, 2.0);
     
     n = clamp(vec2( 0.5 + sin(theta) * rad, n.y), vec2(0.), vec2(1.));
    
     gl_FragColor = texture2D(samplerFront, mix(srcOriginStart,srcOriginEnd,n));
    
    }
    
  • You are normalizing the u,v coords (n), you usually have to denormalize again before you sample the texture again (map it to the region of spritesheet your image resides in.)

    (e.g. sampler2D(sampleFront, mix(srcOriginStart, srcOriginEnd, nUpdated)) )

    If nUpdated.x or nUpdated.y is < 0 or > 1, you need decide how to deal with that, e.g. clamp or set color to a base color (transparent, white, etc.)

  • If you want to update your nw.js, check out these later builds of the Greenworks node files so you can update your nw.js version.

    greenworks-prebuilds.armaldio.xyz

    Also A small plug, I added more ACES for Greenworks API in my free Greengrinds plugin.

  • Great tutorial for c3IDE.

    If you do additional c3IDE tutorials, I suggest:

    - Add interaction with C3 SDK: world info, instance info, change instance parameters (location, size, etc.)

    - Effect (I can supply some simple effect code, if you need and I can add some notes if you want.)

  • I was wondering about this too and tried it, I can get it to work with a plugin, but not with a behavior (it looks the the OnPropertyChanged function is not called when changing the property of the behaior on an instance.

    Here's the code from the top-level instance.js (using the SDK behavior example to test from here: construct.net/en/make-games/manuals/addon-sdk )

    "use strict";
    
    {
    	const BEHAVIOR_CLASS = SDK.Behaviors.MyCompany_MyBehavior;
    	
    	BEHAVIOR_CLASS.Instance = class MyCustomBehaviorInstance extends SDK.IBehaviorInstanceBase
    	{
    		constructor(sdkBehType, behInst)
    		{
    			super(sdkBehType, behInst);
    		}
    		
    		Release()
    		{
    		}
    		
    		OnCreate()
    		{
    		}
    		
    		OnPropertyChanged(id, value)
    		{
    			console.log("***INFO*** id:"+id+" value:"+value);
    			debugger
    		}
    		
    		LoadC2Property(name, valueString)
    		{
    			return false;		// not handled
    		}
    	};
    }
    
  • You are welcome.

    You also _may_ be able to get it to work in worker mode if you use some special global variables and don't need APIs not available in worker mode.

    Check out globalThis in the following manual page:

    construct.net/en/make-games/manuals/construct-3/scripting/using-scripting/javascript-construct

  • macube Sorry, did not finish filling in the link! Updated above.

  • Update release 0.0.2.8.

    Added Greenworks DLC ACEs (see github.com/greenheartgames/greenworks/blob/master/docs/dlc.md )

    I am mainly using Electron for Construct to integrate C3 and Greengrinds / Greenworks / Steam into an executable. Electron for Construct also has the side benefit of download and using the appropriate Greenworks binary (*.node file) for the version of Electron you are building for.

    If you need to use a later version of nw.js, you can try replacing the *.node in your output directory/package with one of these that match the version of nw.s you build with. They were built by Armaldio's nice CI build service (if you use them, don't forget to Donate!)

    greenworks-prebuilds.armaldio.xyz

    (Use release 0.2.8 from the above for all of the DLC ACEs to be enabled.)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Good question. I guess it's more of an user opinion.

    Right now it basically loads a skeleton and allows you to play an animation and mirror the direction. I think it needs at least one more trigger On Animation Finished or Looped, and then it will have at least basic functionality.

    However, what else would you need, looking at the flyover C2 plugin there's some more ACEs (in particular Events.)

    I suggest trying it out now and give feedback on the plugin github site (e.g. as an issue)

  • Congrats on the release! It's so much fun to play with and a ton of great examples.

  • It's by C3 layer and C3 z-order. However, if someone knows how to easily enable the common Z elevation ACEs, I will gladly add them to the ElementQuad plugin also.

  • Some babylon.js 3D render using some simple JS integration with ElementQuad to integrate into C3 render and C3 events (you can put it on different C3 layers, add C3 effects, change size, position, etc. of the rendered 3d image.)

    This is a template which uses C3 JS integration to add Babylon, it's not a Babylon add / plugin. It does use on plugin to show the results:

    construct.net/en/make-games/addons/312/elementquad

    You can also use C3 JS to access/manipulate the Babylon scene/engine, e.g.:

    + System: Every tick

    | Local number alpha‎ = 0

    ----+ (no conditions)

    -----> System: Set alpha to ElementQuad.Sine3.Value

    -----> Run JavaScript:

    scene.activeCamera.alpha = localVars.alpha

    scene.activeCamera.beta = 1.55+localVars.alpha/5

    Babylon Template (requires ElementQuad addon)

    BabylonTemplateLocal.c3p

    Uses local project files for models / glb (works in preview and web)

    babylonjs.com

    Have fun with it...

  • A quick check - do you have worker mode enabled? Sometimes this changes scope available to different scripts.

  • Yes, I thought it might be relative, not absolute.

    You might take a look at this (use JS integration to access it), there are some comments on absolute orientation.

    developerdrive.com/how-to-use-the-device-orientation-api