Code Organization

Discussion and feedback on Construct 2

Post » Tue Jan 28, 2014 9:22 pm

Hey Construct Community,

Do you have any tips or methods to organizing your code?

I use comments to separate each section, but my event sheet is getting quite large.

Do the developers of Construct plan on adding a folder option to store multiple events and minimize for efficiency? I know MMF2 uses "Groups" to condense the code.

Thanks.
B
22
S
3
G
1
Posts: 153
Reputation: 1,883

Post » Tue Jan 28, 2014 9:33 pm

I usually have a "main" event sheet with no events. Then for each category of events (player controls, enemy AI, coins, etc.) I have a seperate event sheet which I include in the main one.

Inside each event sheet I then have groups for each part of that category. So if I'm making a platform game, I'd have my main event sheet which includes the Controls event sheet. Then inside the Controls one, I have a group called general for simulating movement. I also have another group called Wall Jump for that.

I find this to be the best way for me to organize my event sheets, and keeping it easy to find stuff.EncryptedCow2014-01-28 21:34:31
B
46
S
14
G
7
Posts: 603
Reputation: 8,096

Post » Tue Jan 28, 2014 9:53 pm

umm... Construct 2 has groups! right-click the event sheet, and click 'add group'.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,679

Post » Tue Jan 28, 2014 10:10 pm

@EncryptedCow A lot of work, but I'm sure it's worth the effort to be very organized!

@sqiddster You are awesome, you just saved me many headaches. Didn't even see the groups option!
B
22
S
3
G
1
Posts: 153
Reputation: 1,883

Post » Tue Jan 28, 2014 10:12 pm

It might be a hassle to do that with already unorganized events. But starting something new, it's not much more effort to do it.
B
46
S
14
G
7
Posts: 603
Reputation: 8,096

Post » Wed Jan 29, 2014 12:55 am

I like to use comments in other ways too. I use them to add notes and reminders, to mark temporary experiments that I might want to delete later, to remind me what variables are such as 1=yes or whatever. I might use them as a partial "to do" list so if I stop a project at night, I can come back to it and see what I was doing. I basically use them to help me keep a mental note of what each piece of code does so I can quickly scan things.

The main goal with any project with lots of events is to make it as easy as possible to fix bugs or find what I need. It's hard enough fixing a bug in the first place. If it's buried somewhere, it can be even harder to fix.
B
72
S
29
G
35
Posts: 340
Reputation: 22,721

Post » Wed Jan 29, 2014 3:31 am

Very valuable insight.

I often write down my to-do lists, but writing them in comments will save me a lot of paper.
B
22
S
3
G
1
Posts: 153
Reputation: 1,883

Post » Wed Jan 29, 2014 1:22 pm

I just put everything in groups, which certainly helps organise my mind when I'm working on a specific aspect of a project. I rarely use comments but I probably should :P
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Wed Jan 29, 2014 4:32 pm

The other benefit of using groups is that you can deactivate them in your logic which helps add more modular functionality. When I have behaviors or events that should not be able to run at the same time I disable the group they are in until they should be used again.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,573

Post » Wed Jan 29, 2014 7:11 pm

Didn't know you could disable whole groups. Construct 2 is most powerful indeed.
B
22
S
3
G
1
Posts: 153
Reputation: 1,883

Next

Return to Construct 2 General

Who is online

Users browsing this forum: kanjmarrie, RoboticPhoenix, Yahoo [Bot] and 7 guests