Custom Array Plugin

1
  • 1 favourites

Stats

1,481 visits, 2,030 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Recently in my project I was looking to set Array instance variable but there was no such option for Array, so I made custom Array from default.

This is my first plugin so please comment if something could be done easier or better.

Default plugins folder is C:\Program Files\Construct 2\exporters\html5\plugins\ (you may need administrator rights).

1. Copy content of folder 'array' to another folder named 'carray'

2. Open edittime.js file and change following:

at line 4:

"name": "Array",

"id": "Arr",

change to

"name": "CArray",

"id": "CArray",

at line 11:

"type": "object", // not in layout

change to

"type": "world", // in layout

3. Open runtime.js file and change following:

at line 9:

cr.plugins_.Arr = function(runtime)

change to

cr.plugins_.CArray = function(runtime)

at line 16:

var pluginProto = cr.plugins_.Arr.prototype;

change to

var pluginProto = cr.plugins_.CArray.prototype;

at line 75:

instanceProto.onCreate = function()

change to

instanceProto.draw = function(ctx){}

instanceProto.onCreate = function()

4. Restart Construct2 and try to insert new object.

CArray will be shown near the Array in section Data&Storage. You will be able to add instance variables to this object.

Math Exercise On Google Play

Pigeon Rush on Google Play

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!