behavoirs to create generic code?

Discussion and feedback on Construct 2

Post » Fri Jun 14, 2013 2:10 pm

One of the main reasons I stopped using the otherwise excellent C2 because I could not reuse code between lots of similar games.

Having tried stencyl, they achieve something like this by putting the code (using their drag and drop code editor) into a new behavior, then you can save this behavior (and its code) for use in other projects. I have not looked at how they handle the behavior codes interface, i.e. if you can instantiate he behavior (and its code) with parameters, make calls to sub functions/methods etc.

Is this possible in C2? I cant see a way of creating a new behavior (or other object) which has code behind it, but can be exported. I had no luck trying to export/import event sheets, even if all the dependent objects were duplicated in the new project.

Another main reason for not using C2 is that you cant fire your own events. Stencyl has this feature (I am informed by my team).

The final reason for not using C2 is that creating dialogues, settings editing page etc. is a lot of work (for HTML5 mobile browser target at least) requiring all clickable objects to monitor some very hairy state code which got too complex to maintain. Stencyl allows you to set a layer to be active and layers below inactive, so the sprites in the layers below don't get click events.   I know in C2 you can put events in a group and disable groups, but this doesnt work for our complex games with a lot of sprite buttons on a lot of different layers/event sheets (required for a casino game).

As an aside, Haxe seems a great language - dont know if its been considered for C2.

I still prefer C2, if only it could offer "enterprise" features (i.e. code reuse, fire your own events, dialogue handling etc). Adding functions was a big step towards this.
Posts: 370
Reputation: 3,942

Post » Fri Jun 14, 2013 2:36 pm

Oddly enough the plugin sdk behaves exactly like this.
Image ImageImage
Posts: 7,972
Reputation: 92,910

Return to Construct 2 General

Who is online

Users browsing this forum: celstrider and 9 guests