JavaScript coding now available

11
Official Construct Post
Ashley's avatar
Ashley
  • 5 Jul, 2019
  • 950 words
  • ~4-6 mins
  • 8,188 visits
  • 5 favourites

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.

Subscribe to Construct videos now

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!

Subscribe

Get emailed when there are new posts!

  • 27 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Nice! By the way, JS means we can now use coroutines, so I wrote a JSFiddle showing how to get started with using coroutines in your project:

    jsfiddle.net/h03kducr/2

    I will probably write some JS tutorials soon

  • Ashley, please just never ever take the event system away Not everyone in the world can code. I myself cant get my head around it, maybe I'm just dumb, but with the construct event system I can make any 2d game I can think of. Otherwise scripting is a great addition for the smarter folk out there :) Good job.

  • So it's like a DLC?

  • Thank you, this is amazing, now i'll learn to program in JS with construct. Thank you Ashley !!! Thank you so much.

  • thank you was looking for this.

  • Great ! By the way, is it a possibility to scripting with array object ?

  • This is great. i had my doubts about having to pay subscription service at first but you guys more than delivered.

  • I understand the intention behind selling the js feature at additional cost much better now, thanks for the explanation.

  • Now with the new JS feature can we use external js like phaserjs or impactjs

    or three.js ?

  • How will this work for recurring subscribers so next year when the subscription expire and need to be renewed will it be renewed with the js feature at $99? Or will the price then be $99 + $20 for the year?

  • Load more comments (13 replies)