so, you have a bug in you code and ask for help. yet no one seems to help. this may be because your code looks like this:
How to solve this?
well, the following presents some tips on making your code cleaner. I hope this helps you “write” better and more efficient code
step 1: Naming objects & using text objects
instead of having a bunch of objects called “text 1” or “text 24” name them according to their purpose. for example, if you use a text object for a Home Screen, name the object Home Screen. it’s as simple as that
as for text objects, it makes the editor a lot less cluttered (my personal take on it) and, combined with the following tip, will make it cleaner
quick side note: name variables with a purpose too, they’re usually more confusing than objects
step 2: Group objects
this may sound weird at first, but by grouping related text objects into certain parts of the editor, it makes the code a lot easier to access. for
example, if you used several objects to make up a shape art used in-game, then you could group all of them in the bottom left corner to remember where they are. then, you could put a Home Screen in the top right corner maybe and gameplay in the bottom right corner, etc. the possibilities are endless for organization. there is no “right” way to do it, as long as you can understand it easily (and others too)
step 3: Use comment blocks
while you can’t access the comment block without JSON editing, you can create a self variable called “comment” and only use it for explaining what your code does. this is a very easy to to get a makeshift comment block.
step 4: make good use of EVERYTHING
why set the width of an object twice when you only have to do it once? use everything with a purpose, make it so there’s no blocks that are meaningless. this way if you take a break for a month you won’t be confused as how to you have 3 objects doing the same thing.
step 5 (the final step): plan!
uhh yeah probably should have mentioned this first but pretend this was a weird glitch. ok yeah I didn’t plan too much before making this and that’s why this happened. if you don’t plan you may forget key components and it’s going to be a pain to add them in—and more likely than not you’ll clutter the code. I for one have had to create whole new variables looking back on code.
that’s all, and if you have tips then feel free to share them below!
- This was helpful
- This wasn’t helpful
- This was helpful, and I have a tip to share