rexrainbow's Forum Posts

  • It is better separating logic from whole gui module (like MVC model) to increase the reusing ability, so it needs lots of programming experience.

    Copy-paste objects to new project is more easier, imo.

  • Joannesalfa

    It had been done in current rex_nickname plugin if you only want to "creating new object by string name".

    Picking instances by string name is another issue.

  • Joannesalfa

    You might want a "virtual object type", but this nickname plugin is only an alias name of an object type.

  • paala

    One possible solution is writing your own path finding logic, or try my pathfinding plugin of my board system.

  • Here is another simple way to make car AI without any 3rd party plugins -

    Demo ( capx ),

    Demo2 ( capx )

  • Joannesalfa

    The result is correctly. It is better to assign a kind of object a unique name.

    In your test -

    Nickname["red"] = Sprite object, Nickname["blue"] = Sprite object -> nickname is a string name of an object type, not an instance.

    Then create by nickname "red" or "blue" will create sprite object - it works fine.

    Another case, pick "red" object will pick sprite object, it works fine, too.

    If you want to identify instance created by "red" or "blue", try add private value to store "red"/"blue" after created.

  • I vote html5/JavaScript engine only ( current solution ) , unless scirra has more than 10 programmers for engine.

  • Hi there! It seems plugin is not available from link you provided in your first post, unless I'm missing something really obvious!

    https://dl.dropboxusercontent.com/u/577 ... rolling.7z

  • Nitro187

    Here is the origin code of loading, ( downloaded in 1st post )

    	// called when loading the full state of the game
    	instanceProto.loadFromJSON = function (o)
    	{
            var canvasWidth = this.canvas.width = o["canvas_w"];
            var canvasHeight = this.canvas.height = o["canvas_h"];
            var data = this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height).data;
            for (var y = 0; y < canvasHeight; ++y) {
                for (var x = 0; x < canvasWidth; ++x) {
                    var index = (y * canvasWidth + x)*4;
                    for (var c = 0; c < 4; ++c)
                    data[index+c] = o["image"][index+c];
                }
            }
    		// load from the state previously saved by saveToJSON
    		// 'o' provides the same object that you saved, e.g.
    		// this.myValue = o["myValue"];
    		// note you MUST use double-quote syntax (e.g. o["property"]) to prevent
    		// Closure Compiler renaming and breaking the save format
    	};[/code:26psdbe6]
    
    "ctx.getImageData" only copy image data, not get the reference. Any modification of this data array would not affect the canvas image.
    [code:26psdbe6]var data = this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height).data;[/code:26psdbe6]
    
    The solution of change the image of this canvas is using "ctx.putImageData", imo. Since this method needs an image data parameter, I use "ctx.createImageData" to create a new one, then fill it by saving data. Finally put this new image data back by "ctx.putImageData",
  • Nitro187

    Loading by official load action.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • R0J0hound

    These code could fix the bug of loading.

    	// called when loading the full state of the game
    	instanceProto.loadFromJSON = function (o)
    	{
            var canvasWidth = this.canvas.width = o["canvas_w"];
            var canvasHeight = this.canvas.height = o["canvas_h"];
            
            var img_data = this.ctx.createImageData(canvasWidth, canvasHeight);
            var data = img_data.data;
            var cnt = data.length;
            for(var i=0; i<=cnt; i++)        
                data[i] =o["image"][i];   
            
            this.ctx.putImageData(img_data, 0, 0);
    	};[/code:31ka48yz]
  • You might see the source code of official websocket plugin first.

    To include external file, add

    "dependency": "file_name"

    in edittime.js, see SDK for more detail.

  • I and made another tag text-like plugin: BBCode text plugin. (Demo)

    It might be more intuition, imo.

  • Set text properties by bbcode

    It supports bold, italic, text color, or size properties recently.

    See demo first,

    • type something at textbox

    Document, plugin and sample capx are included.

    It also supports scrolling and typing by rex_text_scrolling behavior / rex_text_typing behavior.

  • Update rex_tagText plugin, rex_text_scrolling behavior, rex_text_typing behavior -

    Now scrolling could be used while tag text has "class" and "style" tags ( sample capx ), previous version only could scrolling tag text which has "class" tags.