rexrainbow's Forum Posts

  • Update:

    Add an internal function for integrating with sprite bank plugin.

  • The new version of sprite bank had been released named instance bank.

    Sprite Bank

    (update:2012/05/11)

    To save some properties of sprite instances(save instances into bank), then create instance and set these properties(load instances from bank). A kind of serialization of sprite instance.

    The chart of how to use it is -

    <img src="http://i1081.photobucket.com/albums/j352/rexrainbow1/file-6.png" border="0">

    "Action: Save instances": saving properties of instances into bank

    "Action: Load instances": create instances and set properties from bank

    "Expression: BankToString": transfer bank to JSON string

    "Action: Load bank": transfer JSON string to bank

    The saved properties are

    • inst.x
    • inst.y
    • inst.width
    • inst.height
    • inst.angle
    • inst.opacity
    • inst.visible
    • inst.cur_frame
    • inst.private variables
    • inst.layer
    • inst.cur_animation.name
    • custom data (*option)

    Example

    For advance user, sprite bank provides calling function plugin when save/create instance. (See test_sprite_bank_adv.capx in example) It can do some custom actions like save/restore properties in behavior.

    On saving instance, put data into return[name].

    On creating instance, get data from prame(name).

    So you can save the speed of bullet behavior then restore it when created.

    Actually, the string of callback not only a function name, but also a command used in "action:execute commands", so you can put some parameters in the string.

  • I'm interested in "addDestroyCallback" in pin behavior.

    I found that each pin behavior will push a function object to runtime's "destroycallbacks" array through "addDestroyCallback". Function object array "destroycallbacks" will be executed when each object destroyed.

    When pin behavior had been destroyed, the callback in "destroycallbacks" will never been removed.

    If I create many many pin behaviors, these might insert many many function objects into "destroycallbacks" array and never remove it. It's not a bug, just a little ... drawback.

  • I put some variable into "" followed the minify rule.

    Now it can connect to server, but the custom event (emit) is not correct, my server say it lose a parameter. I can not understand the code after C2 minify. Maybe there still other errors.

    PS. I use Socket.IO.min.js build:0.8.7 in my plugin chat.

  • I check this plugin, and finally understand why ZSort is "world" type, not a "object" type.

    It's because that ZSort need to get the layer parameter. If the plugin is "world" type, it must be put in a layer. So ZSort can sort this layer. On the other word, ZSort can not sort other layers.

    If you like the ZSort with "object" type. You can try this. It need to indicate the layer number/name.

    I change the icon and plugin id, too. The author is still juantar(Juan Pablo Tarquino).

  • I had tested "Condition:on Function", "Action: Call function", and "Expression: Call" from example in 1st post, work fine after exported with minify.

  • kiyoshi

    Thank you.

    In example, I put an example of using AJAX and an exported folder by minifier. It works.

    Can you list the properties of function (ex: fn.param["x"], fn.result) used in your application? Maybe I miss something.

  • "real time online networking" is another problem.

    For turned based game, the question is, do we need to put some logic in server to prevent cheating? If yes, designer need to learn server coding.

    If no, designer may use network just like chatting and make whole game in C2.

    For real-time... well..

  • Zack0Wack0

    Thank you for your socket.io plugin ,and the python server. I ues it in my chat plugin. The only question is, I can not minify it in C2.

  • Update:

    Update platformMP following r73.

    Thank you Ashely for the great platform behavior.

  • kiyoshi

    This bug seems be solved in r73

    Found a bug with this plugin. To reproduce it: Create three layouts. On layout2 add On Function "Foo1" -> Make Something like Set Text to "Foo1"

    then add On Start of Layout -> Call Foo1

    On Layout 3 add On Start of Layout -> Set Text to "Layout3". On Layout1 add reference to Layout 2 then Layout3

    Expected result when running : Text is "Layout3" .

    Current result: Text is "Foo1"

    That is, The call to Foo1 is preventing the execution of On Start of Layout for all other layouts after the layout where Foo1 executes.

  • DiggyDog

    I put an example in original zip file. See test_fn_js_inject_AJAX.capx,

    and an exported folder, the code string is put in file "fn.js".

    You can type the code string in C2 editor, or use AJAX to load from external file.

  • If the problem is "" , try loading code string from AJAX plugin.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Function plugin, unofficial.

  • Hi Ashley,

    Could it possible to mark a non-minify code area?

    I know the constrain of minify. The minify not only change the variable name, but also 'compile' the code. The behavior before minify/after minify 'might be' different.

    (Does physical behavior have this problem before?)