In the last post in the Blog, I talked about a fairly recent article from Scirra, about the performance tests performed and compared between JavaScript and GML(GameMaker Language). In this article I’m sharing something else exciting, regarding JavaScript. As of today 9/24/21, Ashley(Founder of Scirra), has begun writing up a set of tutorials to teach anyone how to script using JavaScript by practicing the craft within the Construct game engine. The tutorials are still very early on, and as far as I’ve seen and read, there are two tutorials in the series thus far covering some of the very basics of JavaScript.
This can be an interesting and fun way for anyone to learn the ropes of coding in JavaScript. These tutorials can also be followed along with in the free version of Construct. So there is no need to purchase anything right out the gate to start learning JavaScript through reading and practicing through this series of tutorials. I’ve read what is available so far, and it’s very well written, and thought out, as usual.
As of right now, the available tutorials cover the basics of JavaScript. The first tutorial in the set starts with a very basic “Hello World” example, you have probably done in other programming/scripting languages(if you’ve learned any others). It’s usually the very first tutorial I’ve seen for any type of coding language I’ve learned over the years. The exercise usually teaches a way to display the text “Hello World” somewhere on the computer screen.
The first tutorial covers adding a custom JavaScript block to a Construct Event Sheet. Then walks through adding a very basic line of JavaScript “console.log(“Hello world!”);“, which will basically log the text “Hello world!” within your web browsers console(accessed through the dev tools). Next, Ashley, walks through opening up your web browser’s dev tools area, then browsing to the Console tab to view the text you have just stored there. There is also a couple short sections at the end of the tutorial showing how to change the message, and also testing code directly in the console and see it run immediately.
In the second tutorial. You can learn more of the basics of JavaScript. First covering the basics of JavaScript Statements, and Comments, along with how they function. Comments are critical for being able to view your script, or event sheets, and know what blocks/code are doing what, and where. I use the Comment block all the time in my event sheets to keep things organized into sections. Almost to the point of being OCD, but I like to keep things tidy and organized. This allows me to quickly browse through an event sheet and find different sections, and groupings of Event Blocks I have laid out over time. After that, the tutorial goes onto declaring and assigning variables in JavaScript, along with the different rules for using variables, and the different types of variables. Other than that it covers a couple of other small things, like dynamic typing, and the “typeof” operator.
As stated at the start of this article, I think this tutorial series will be a fun way for anyone to start learning JavaScript, and eventually get to the point where they can really dive in and customize their projects in Construct. The tutorials are geared towards beginners. But, it will really help if you at least understand the basics of Construct, and some of the basics of coding/scripting. Such as being familiar with what variables, loops, and functions are and how they function in the Event Sheets. It’s not mandatory, as you can certainly learn along the way, but understanding the basics will help understand and grasp the material available to you there. Below I’ve linked you to the two available tutorials in the series.
I hope you enjoy the journey, and are having a fantastic day 🙂
Tutorial #1: https://www.construct.net/en/tutorials/learn-javascript-construct-2800
Tutorial #2: https://www.construct.net/en/tutorials/learn-javascript-construct-2802