Comments, comments everywhere!

5
Official Construct Team Post
Laura_D's avatar
Laura_D
  • 22 Nov, 2019
  • 327 words
  • ~1-2 mins
  • 1,002 visits
  • 1 favourites

Things have been rather manic for me recently, so, until Tuesday, it'd actually been quite a while since I'd done any work on my game. This meant that a large chunk of my stream that day was tweaking a few bits, and figuring out what was still broken.

Where am I going with this? Well, during that whole 'figuring out' process, I realised that my player movement event block was far more complicated than it needed to be and could definitely be tidied up with a function or two. So, I wrote myself a little note which said:

Write functions for this you mad woman!!

Humour aside, when I actually got around to doing the swap to functions, I realised that this mechanism I wanted to tidy up was quite deeply rooted in other areas I'd forgotten about. And while Find all references came to my rescue, one other thing would have been extremely useful - comments.

You probably already know but you can comment on pretty much everything in C3 - and you should be. It's tedious, to begin with, but when you come back and look at your code after a break, you'll immediately know what everything does. Or at least should do.

So, my game is currently undergoing a bit of a refactor, and a big part of this is making sure absolutely everything is commented so I know exactly what I've created.

See? They're everywhere!

I know full well this is going to take me a while to sort out, but it's a good habit to get into and should I need help down the line, if someone else looks at my project, they'll know what I've intended to do with my events!

So use comments! They're also a good way of putting together ToDos on your events so you can keep track of ideas as you get them.

Anyway, I'm going to get back to my refactor/commenting fest. Til next time!

Subscribe

Get emailed when there are new posts!

  • 4 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Tidy events, commented code. Good.

  • Wise remarks. Also you can note that in Construct you can add comments within the actions now (very helpful when you have a big actions list to organize them according to what part of your game they will apply to).

    Moreover, thanks to bbcode you can format the content of your comments (note some things in bold for example).

    At last you can set the text and fill color of the comment through the contextual menu, allowing oneself to "beautify" your event sheet and add further structure to help making it more readable at a quick glance.

  • Thanks for this great resource on using JSON for dialogue! Is it possible to download a copy of the file you’re discussing in the video?