Why use JavaScript/TypeScript in C3?

Not favoritedFavorited Favorited 0 favourites
  • 5 posts
From the Asset Store
[C2] [C3] Support C3 build service and Android 14
  • I’m getting back to Construct after a while and noticed that now we even have the option to code with JS/TS. At first, I thought it was interesting, but then I started wondering: why? Is it just for people who prefer writing code, or are there other benefits? Are there things that work better or perform better through code? Are there things you can do with code that aren’t possible with events? Thanks!

  • Are there things you can do with code that aren’t possible with events?

    Yeah there's some. I find that working with any kind of arrays and data objects is much easier in javascript. There's also how picking works in Construct, that you e.g. cannot loop over a combination of two object types, which you can easily do in js. Subclassing is imo one of the best features which does not have a real equivalent in events. You can get sort of close with custom actions, but not quite.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Could some of the things that are better in scripting be used as inspiration to improve Event coding at all?

    As someone that uses Construct because of the Event Sheets and because I don't like scripting, I'd rather see the event system improved to the best it can be.

  • It’s mainly useful to interact with other js/ts libraries if you don’t want to deal with making a plugin. Although plugins/behaviors are simpler to use for end users and provide some deeper hooks into the engine.

    It’s also a nice advertisement point for Construct and attracts some users that don’t like visual coding or look at it as a way to dabble in coding along with events.

    JavaScript/typescript code can perform better than events for more algorithmic stuff but it really depends on what you’re doing.

    There are pros and cons of course. Cons off hand are you have to deal with more boiler plate code to interact with the api, debugging is more involved, and you’re kinda thrown out there dealing with how those languages work. Construct can only help so much with that.

    Overall events and typed code have their own workflows and it mostly comes down to personal preference. Pick your poison. They all have their annoyances when trying to implement some logic.

  • Rojo's reply made me realize another thing: with typescript code, you can have typed code, wich is not possible with events. That's interesting.

    Awesome, thank you very much guys.

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)