0 Favourites

Code Organization

  • 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.

  • 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.

  • umm... Construct 2 has groups! right-click the event sheet, and click 'add group'.

  • 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!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • Very valuable insight.

    I often write down my to-do lists, but writing them in comments will save me a lot of paper.

  • 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

  • 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.

  • Didn't know you could disable whole groups. Construct 2 is most powerful indeed.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
78 10,778
Josek5494's avatar
Josek5494
Unread hot topic
61 4,810
Reuben's avatar
Reuben
Unread hot topic
28 2,116
michael's avatar
michael