Make your first plugin - Facebook Payments

4

Index

Stats

9,807 visits, 23,603 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.

Published on 17 Aug, 2015. Last updated 19 Feb, 2019

EDITTIME.JS

The edittime file has a host of options and settings. Some of which we will not be using today. For a full list please refer to the well written SDK over at

SDK manual

What you see is the first 28 lines are contained inside of brackets { };. Inside of these lines are the main plugin settings. The first line we will edit is line 4 which contains

    "name":			"MyPlugin",

This is the name that is displayed when you click insert object inside of Construct 2. Change the MyPlugin to "Pay Dialog".

The next line down is the hidden name of your plugin. This needs to be unique, if another plugin shares the same name, you will generate an error message. Also, never change this value after your first time. Doing so can completely break the plugin for some users.

    "id":			"MyPlugin",	

Change the MyPlugin to FB_PAYSME. That should avoid any conflicts. Whatever you change it to, remember it. We will be referencing it while editing our next file.

The next few lines go from version to category. For the sake of this just set the category value to Facebook.

The next item down is type. This is one of two values. Either "world" which means that the plugin actually draws something on our application screen or "object" which means something that isn't physically drawn. We are going to chose object and heres why. While our dialog will appear to the user, it isn't actually going to be part of our browser window. Facebook will open it's own window separate from our app. Make sense? So make sure to choose "object" for the type line(line 11).

Ok, next is rotatable. This is either true or false. True would mean that the object is drawn on our screen and we can rotate it to any particular angle. The type above must be world if this is going to be true. However, we do not draw the dialog and our type is object so change this to false.

The next line is flags followed by a zero(0). This is the beginning of our remaining flags to set(remaining control items). Look below and you will see the next few lines start with //. In javascript this means that anything after it on that line is to be considered a comment, or not usable code. To make a line active we just remove the two // preceding the item we want. For our purposes just remove the two // on line 14 which is the singleglobal line. This means that you can only insert the plugin once(You cannot have multiple copies like the sprite plugn).

While we left the rest commented because we didn't need it, you should read through each line and familiarize yourself with what each means. There is a description at the end of each line.

  • 0 Comments

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