updated Plugin tutorial (Release: 221)

0 favourites
  • 3 posts
From the Asset Store
Carousel Animation, make carousel of you image gallery or anything
  • Hello,

    does anybody have an updated tutorial for creating a simple plugin?

    The "https://www.scirra.com/tutorials/352/plugins-roll-your-own-with-the-javascript-sdk" Tutorial doesn´t work with the current version, because of the .draw function call in the "instanceProto.drawGL = function (glw)"!

    As i heard, we should only use the drawGL function, but is there an example? My test was:

    ctx.strokeStyle="#FF0000";
    ctx.strokeRect(20,20,150,100);[/code:hx0youwk]
    in the .draw function -> how do i adapt this to the drawGL?
    
    Thanks in advance
  • Try Construct 3

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

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

    See the official text plugin, it could draw at canvas2d or webgl both.

  • Hey ConstructorRichi, <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    I made my own modified version of the SDK template files, with some extra information comments, and a more graphical style of divider comments to break up and mark the different sections of code.

    I'm planning on making a tutorial to go along with my modified version of the SDK at some point, but I can upload a copy for you to take a look at now in case it might help. <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    https://dl.dropboxusercontent.com/u/382 ... mplate.zip

    You may alraedy know this, but the one really important step in creating a plugin is to make sure the "id" value you choose for the edittime.js file, matches two spots in the runtime.js file.

    In my SDK mod the places that must match are marked in both files with the following placeholder text:

    XXXXXXXXXXXXXXXX_MyPluginID_XXXXXXXXXXXXXXXX

    (Note the "ID" in the placeholder text.)

    edittime.js

    (Note the first placeholder is for the NAME, not the ID. Only the ID has to match between files.)

    //╔════════════════════════════════════════════════════════════════════════════╗
    //â•‘///////////////////////////////   Settings   ///////////////////////////////â•‘
    //╚════════════════════════════════════════════════════════════════════════════╝
    function GetPluginSettings()
    {
    	return {
    		"name":			"XXXXXXXXXXXXXXXX_MyPluginName_XXXXXXXXXXXXXXXX",
    		"id":			"XXXXXXXXXXXXXXXX_MyPluginID_XXXXXXXXXXXXXXXX",[/code:28nntpg6]
    		
    [b]runtime.js[/b]
    [i](You may need to scroll down a little to see both placeholder spots.)[/i]
    [code:28nntpg6]//╔════════════════════════════════════════════════════════════════════════════╗
    //â•‘/////////////////////////////   Plugin class   /////////////////////////////â•‘
    //╚════════════════════════════════════════════════════════════════════════════╝
    
    //----------------------------------------------------------------
    // *** CHANGE THE PLUGIN ID HERE *** - must match the "id" property in edittime.js
    //          vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cr.plugins_.XXXXXXXXXXXXXXXX_MyPluginID_XXXXXXXXXXXXXXXX = function(runtime)
    {
    	this.runtime = runtime;
    };
    
    //----------------------------------------------------------------
    (function ()
    {
    	/////////////////////////////////////
    	// *** CHANGE THE PLUGIN ID HERE *** - must match the "id" property in edittime.js
    	//                            vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    	var pluginProto = cr.plugins_.XXXXXXXXXXXXXXXX_MyPluginID_XXXXXXXXXXXXXXXX.prototype;[/code:28nntpg6]
    
    [b]C2 plugin video tutorial - by John Velojet[/b]
    I found this nice walk-through for setting up a super simple plugin from start to finish. 
    [youtube video="ZlgJ4ts00C4"]
    [i](This is actually the first tutorial I use to make a working plugin, back when I started looking into making plugins.)[/i]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)