Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
gdevelop:tutorials:usingjsevents [2020/06/01 08:27]
rapperdinesh [How to use Javascript events]
gdevelop:tutorials:usingjsevents [2020/06/13 11:38]
rapperdinesh [Use external source files]
Line 33: Line 33:
 Using external Javascript source files (.js files) is very easy: just include it into the folder of the game (or a subfolder). Using external Javascript source files (.js files) is very easy: just include it into the folder of the game (or a subfolder).
  
-Then, activate the use of external source files in your game property (right click on the game name in the Project Manager, ​than choose properties, and finally check ''​Activate the use of C++/JS source files''​).+Then, activate the use of external source files in your game property (right-click on the game name in the Project Manager, ​then choose properties, and finally check ''​Activate the use of C++/JS source files''​).
  
-Now there is a new item in the structure of your projet ​called ''​Sources''​. Make a right click on it to choose to create a new source file or to import an existing one.+Now there is a new item in the structure of your project ​called ''​Sources''​. Make a right-click on it to choose to create a new source file or to import an existing one.
  
 {{ gdevelop:​tutorials:​externaljavascriptfiles.png?​nolink |}} {{ gdevelop:​tutorials:​externaljavascriptfiles.png?​nolink |}}
  
-You can edit the files using GD integrated editor or you preferred text editor (take a look at [[http://​www.sublimetext.com/​|Sublime Text]]). When your game will be exported or when you launch a preview, the source files will be integrated ​to the game.+You can edit the files using GD integrated editor or your preferred text editor (take a look at [[http://​www.sublimetext.com/​|Sublime Text]]). When your game will be exported or when you launch a preview, the source files will be integrated ​into the game.
  
 Source files are included like any other javascript file: if you want to access to functions defined inside, you have to store them into a global object or make these functions globals (just declare it with any prefix, like this: ''​function myFunction() { ... }''​). Then you can call them from your events using a Javascript event. Source files are included like any other javascript file: if you want to access to functions defined inside, you have to store them into a global object or make these functions globals (just declare it with any prefix, like this: ''​function myFunction() { ... }''​). Then you can call them from your events using a Javascript event.