Scirra has recently announced and then released a new feature for Construct 3: Javascript coding in the editor. I was extremely hyped by this announcement and c...
What do you mean?
It's a way of using your own custom class deriving from WorldInstance. So you can add all your own custom properties and functions, and still do everything WorldInstance does.
That's interesting, how would it work exactly?
Is it already possible in r151?
Edit: nvm I just got what you meant. But that's already what I kinda do in the article, except I don't have access to the WorldInstance class so I made my own and get WorldInstance later. I didn't mean to make it possible, I meant to make it integrated in the editor and have a better workflow for it
See Subclassing instances for how this works in r152.
That is pretty cool indeed, that's enough to write some kind of workflow of my own. However I still think it would be pretty cool to see an integrated workflow to the editor in order to make development easier when using JS only.
I don't know what you mean by that - can you explain exactly what that would do, how it would work, and what benefits it would offer the way it works with subclassing?
Well the simple answer is:
Right now it's technically possible to make games using JS only. However the things you did for Ghost Shooter will not work for a much bigger project. Anything that will have more than 10 concurrent systems working together will be very hard to organise to work with.
I would love to actually write something that would represent what I mean, but I'd need to properly design (and possibly code) it for it to be crystal clear. And even then, since I have only a limited understanding of the inner workings of the engine and that I cant access the engine code, you will very probably find flaws to what I can give you.
I don't see why the approach used in the Ghost Shooter code demo wouldn't work for a large project. You can sub-class as many kinds of object as you like.
You can also use a deeper class heirarchy to avoid code duplication. This is just normal use of JavaScript classes. For example you could have custom MonsterEnemyInstance and ZombieEnemyInstance classes, both of which derive from a custom EnemyInstance class, which derives from Construct's IWorldInstance. Now you can do things like write a single EnemyInstance.die() method, and it can be used with both MonsterEnemyInstance and ZombieEnemyInstance. So as far as I can tell this appears suitably scalable to large projects without code duplication.
Anyway, the idea is to have a unified way to write js scripts that can better fit larger projects, which are the ones that will probably make most use out of the js feature.
That's the main benefit: Being able to easily write JS code that can be extended and modified at ease without having to preface it with tons of utility functions and an additionnal layer.
How it would work: Sadly I cant really go into more details than what I say in the blog post. I will try to write something using the available features and send a c3p file once I have something that's closer to what I envisionned using the newly available features but it's still gonna be limited compared to what you guys could actually do.