Lunarovich's Recent Forum Activity

  • Hey, I've got it ))

    This works and makes sense (although it's a bit convoluted for my taste...):

    var dictInst = dict.getFirstPicked();
    dictInst.type.plugin.acts.AddKey.call(dictInst, "ace", 51);
    console.log("SUCCESS: " + dictInst.dictionary["ace"]);
    [/code:1e4ffs47]
    
    Hope to finish soon rot.js C2 integration and offer an intuitive way to make a roguelike for all those roguelike fans
  • Thanks for your thorough and informative answer. I don't know why such a useful functionality should be bogged down by this intricate function call chain / object reference chain.

    Could you please point me to some plugins where I can see the examples of this going on?

    P.S. Here are the first results of making a plugin out of rot.js library:

  • Hello, I've just started to "roll my own" plugin <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

    However, I am confused about how to access ACEs (conditions, actions, expressions) inside the runtime.js. For example, I have this piece of code in my edittime.js:

    AddNumberParam("Size", "Enter a map size.");
    AddObjectParam("Object", "An array to store the map in.");
    AddAction(1, af_none, "Generate map", "Generator", "Generate map of size {0} and store it in {1}", "Generate a 2D map", "GenerateMap");
    [/code:1wll1i8q]
    
    I send an Array object form inside the C2,
    
    [img="http://i.imgur.com/J2xQS3e.png"]
    
    Now, from inside my runtime.js, I would like to be able to call, for example, SetX() function of the Array object. I've managed to do something similar with
    
    [code:1wll1i8q]
        	Acts.prototype.GenerateMap = function (size, array)
    	{
                var arrayInstance =  array.getFirstPicked();             
                arrayInstance.set(0, 0, 0, 23);
    	};
    [/code:1wll1i8q]
    
    However, this one will not work
    
    [code:1wll1i8q]
        	Acts.prototype.GenerateMap = function (size, array)
    	{
                var arrayInstance =  array.getFirstPicked();             
                arrayInstance.SetX(0, 23);
                // this one neither: arrayInstance.acts.SetX(0, 23);
    	};
    [/code:1wll1i8q]
    
    I have understood that I can access all the functions which are attached on the [b]instanceProto[/b] object. This makes sense, since I am accessing functions of the instance of the plugin. For example,
    
    [code:1wll1i8q]
    	instanceProto.set = function (x, y, z, val)
    	{
    		x = Math.floor(x);
    		y = Math.floor(y);
    		z = Math.floor(z);
    		
    		if (isNaN(x) || x < 0 || x > this.cx - 1)
    			return;
    			
    		if (isNaN(y) || y < 0 || y > this.cy - 1)
    			return;
    			
    		if (isNaN(z) || z < 0 || z > this.cz - 1)
    			return;
    			
    		this.arr[x][y][z] = val;
    	};
    [/code:1wll1i8q]
    
    However, I see that ACEs are neither attached to the [b]pluginProto.Type.prototype[/b] nor to the [b]pluginProto.Instance.prototype[/b], but directly to the [b]pluginProto[/b]. (The latter is the "shortcut" to the [b]cr.plugins_.MyPlugin.prototype[/b]). So, if I access types and instances functions/properties via type. and inst., how do I access ACEs which are attached directly to the prototype of the plugin?
    
    I want to do all this, in order to learn how to implement plugins/behaviors and to implement a C2 http://ondras.github.io/rot.js/hp/  interface. This will facilitate the job of making roguelikes in C2.
  • If you have a sufficently small number of objects, you can simply move objects around placing them on different layers. Afterwards, you can test the layer the sprite is on with the Sprite.LayerName expression or similar.

  • Hello. The best way to show and hide the sprite would be to use the set visible action which "sets the object visible or invisible (hidden)." Measure the time with the dt expression (which gives you the amount of time in seconds since the last tick.) You can set up a variable and do a variable = variable + dt and than compare that variable to some given value, say 5 sec.

    To count the number of times the sprite is visible/invisible, use a counter variable (instsance variable or a global one) and increment it when the sprite is shown or hidden.

    For the gradual reduce of the time, the best way would be, in my opinion, to use some quadratic function of the counter variable mentioned above.

  • Hi, you can try to inspect the z-order of the sprites in question...

    Basically, ZIndex property gives you "the zero-based index of the Z order of the instance within its current layer. 0 is the bottom instance, increasing up to the top instance."

    Do a simple < or > test on your sprites...

  • Maybe a number of your lightmasks is simply too small to notice any performance difference...

  • Yeah, thanks for the tip.

    Although C2 does not render non visible parts of the layout and there is no performance loss, Paster still renders off screen to the intermediate texture, I suppose. Did you test the performance on the large layout or is it just an educated guess?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Katala, thanks for the blend mode additive tip for pre-baked light tints. Probably a better solution on the level of aesthetics and performance than my TintMask application.

  • And here is my LightMask/TintMask example, made specially for this friendly forum...

    EDIT: This example has a single layer dark mask (whit light hole punched in), light tint mask (cycle) and sine opacity and size behavior, used to simulate the light flicker.

  • Here is another nice light tinting screenshot...

  • Thanks! Actually, yes, you can tint your light...

    However, since original LightMask is in a "destination out" blend mode, you'll have to make another mask (I call it originally TintMask ) and synchronize its position, angle, etc. with the LightMask. You put your TintMask on top of all objects in the target level.

    I am using the sine behavior for the opacity and size on the LightMask in order to give some flicker to it. Naturally, you do not see it on the picture, but the effect is just great

Lunarovich's avatar

Lunarovich

Member since 6 Mar, 2014

Twitter
Lunarovich has 1 followers

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies