How To Make Your Code Neater

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!

was this helpful?
  • This was helpful
  • This wasn’t helpful
  • This was helpful, and I have a tip to share

0 voters

@The_Somebodies

17 Likes

Tip 1.

Name your objects

It’s quite simple, this would help you know where your stuff is and be more organized

Tip 2:

If you do not have scenes then break your code off into sections. Maybe have all the objects that have something to do with the main menu on the right, and put the things that have stuff to do with visuals on the left. This would help you stay organized again, and if others wanted to view your code they could easily find it.

Tip 3:

You might not want to use a lot of shapes in the editor. Sometimes it gets very cluttered and hard to view.

If you still would like to do that, you can resize objects in the editor. You can pitch in or out on an object to make it bigger or smaller.

Note: It does affect the real size of the object

Nice topic @Nobody, those are 3 more tips!

5 Likes

thank you so much. this topic has helped me realize why only 10% of the people i ask don’t help me. i’ve been trying to make things neater, and also more conservative to storage space, so thank you!

4 Likes

Lol yours is super simallar

3 Likes

Good tips! I have 1 tip:

Close the code (press the ^ button). That way, you see the for example, {when game starts} and then open it and you can edit something. I think this is extremely helpful big projects, so that you don’t have to spend
A-LONG-TIME scrolling up and down.

Note: you don’t have to close all of them… sometimes it’s good to keep parts open.

2 Likes

Pft, Soar 3 be like

2 Likes

unfortunately that doesn’t save (as in they don’t stay closed) if you exit the project but that is a useful tip

1 Like

Yeah… that kinda is annoying…

1 Like

Great tips! Another helpful thing is a) deleting unused abilities and b) using/creating custom abilities. Saves a lot if time

2 Likes

Before I discovered custom abilities and clones, I had 64 squares that I had to change each ones code many times

2 Likes

Super helpful! Thanks for making this topic :smiley:

1 Like

Saaad

3 Likes

Yeah, including clones soar 3 has over 325 total objects at the start, and over 500 after several plays.

5 Likes

Soar 3.01 is an awesome Game

2 Likes

Outa likes
Take this
:custard:
It’s flan

3 Likes

I love :heart: flan

1 Like

I got the nice topic like.

1 Like

Yeah you are way better than me at coding

That doesn’t make me better lol

1 Like
  1. Custom blocks are a m a z i n g

  2. Use control blocks like repeat instead of just repeating the same code over and over
    though I often just end up repeating the code but don’t do what I’m saying right now use repeat

1 Like