We're pleased to announce that JavaScript coding is now available in the latest Construct update r157! See our last blog Introducing JavaScript coding in Construct for more background.
JavaScript coding, also known as the scripting feature, lets you use snippets of JavaScript code in event sheets. There is tight integration between event blocks and JavaScript code, allowing you to use whichever best suits the task at hand. You can also use only event blocks, or only JavaScript code - it's up to you.
We're keen to make sure there's still a strong community for those who only use event blocks. In particular we don't want to end up with people answering questions with "just use JavaScript". This is why the scripting feature is sold separately, making scripting a separate edition of Construct 3.
Video overview
Watch this video for a more detailed summary of how the scripting feature works. Note it doesn't attempt to teach you the JavaScript programming language - there are lots of resources for that around the web already, since it's one of the most popular programming languages in the world! However it demonstrates how to use JavaScript coding in Construct, and some of the ways event sheets and JavaScript code can be combined.
Learn to code
It couldn't be easier to write your first line of code. You can add a line of JavaScript code in place of an action or block.
You can also add script files, and call functions in them from scripts in the event sheet too. There's plenty of scope to be creative and conveniently start integrating event blocks and code!
There's even the option to write your entire game in JavaScript. Click here to open the Ghost Shooter in code demo for an example - it recreates the Ghost Shooter tutorial using only JavaScript code, with no event sheets or even behaviors.
Documentation
There is now full documentation for the scripting feature in the new Scripting section of the manual. It covers how the feature works in Construct and also covers all the APIs (Application Program Interfaces, i.e. all the available classes and functions) comprehensively. As we continue to improve the scripting feature over time, more content will appear in the manual too.
Free edition limits
If you're using the Free edition of Construct 3, the following limits apply when using JavaScript coding:
- Maximum 1 script action in an event sheet
- Maximum 1 script block in an event sheet
- Maximum 1 script file in the project with up to 50 lines as guest or 75 lines with a registered account
Purchase a plan to remove the limits! If you purchase before September 2nd you'll get the scripting feature at no extra cost - so now is a great time to subscribe.
Purchasing the scripting feature
For many years Construct has focused on having the best block-based system on the market, specifically aimed at non-programmers. We feel this is still an essential aspect of Construct and we want to make sure we preserve this reputation and don't end up being seen as just another coding IDE. In particular we're keen to make sure there is still a strong community dedicated to using the event blocks approach only, especially since it's still the best place for beginners to start. Also those who don't want to use JavaScript coding shouldn't have to pay any extra for it.
Therefore the scripting feature will be sold separately. It'll cost only $20 USD/year (USA pricing) on top of a Personal subscription, equivalent to a mere $1.67/month. This means you'll be able to purchase Construct 3 with event blocks as before at an unchanged $99/year, or with both event blocks and scripting for just $119/year. This will be introduced on September 2nd. All existing subscribers at that point will get the scripting feature permanently at no extra cost, even if they cancel and re-subscribe - so purchase before then to save! We'll announce more details about pricing for other plans and currencies soon. And don't forget as ever the subscription covers all other features and export options, making it a strongly competitive option versus many other comparable tools on the market.
For those who want to use JavaScript coding, it's a low cost to get on board. However having separate editions of Construct both with scripting and without will help ensure non-programming users remain a distinct and important part of the community.
Events will improve too
While JavaScript coding is a new direction for us, by no means are we giving up on the non-programming features. We want to you know that the event system isn't going anywhere and we will be continuing to improve it over time as well! Getting beginners in to making games is what Construct is all about, and using event sheets is still the best way to get started. We've spent the past few weeks highlighting JavaScript coding as we know many users are excited about it. But if you don't want to use it, rest assured there will still be more updates coming your way.
More to come
This is only just the beginning! We have lots more features planned involving scripting, including autocomplete, more APIs, and library classes - as well as other updates for the event system - and they'll appear soon as we keep up with our unmatched regular update schedule. Stay tuned for more updates coming in future, and be sure to pick up a plan by September 2nd to get scripting at no extra cost!