Well, I am making a pop it game and i want to create a circle grid but it’s SO hard to perfectly align it and it stumps me when i code it… if you can help i can credit you
hey @reb! if you check in your magenta blocks, there’s a custom block titled make a grid and it works perfectly with all shapes! here’s an example:
hope this is what you’re looking for!
i just noticed how messed up the thumbnail is, mb. i was trying to hurry haha
Here’s a fast grid code I made. Works for any shape, I just used rounded squares to demonstrate.
rows: how many objects along the X-axis
columns: how many objects along the Y-axis
origin X/Y: reference from the bottom left object
align X/Y: only used when “center”, “left”, “right”, “top”, or “bottom” are inputted. The grid is center-aligned in my example.
size; the size of each object in grid, in HS units
gap: how far each object is from each other. 0 will make them touch.
It also depends: did you want a grid that uses circle objects, or a grid in the shape of a circle? (which is much harder)
Not square, circle
I meant this shape
Yeah, that’s near impossible to get just right.
Why?
Well, yeah, but what if you want one that’s bigger?
Edit: saw you redacted something… circles are just hard in general.
Maybe it’s possible to make a square grid and then delete all clones that are too far from the center?
That would technically work. It would work best for odd sizes, but not so great for even sizes.
I meant this, not a perfect circle (the pop it rows):
Row 1 has 3 circles
Row 2 has 5 circles
Row 3 has 6 circles
Row 4 has 6 circles
Row 5 has 5 circles
Row 6 has 3 circles
If you want just that specific one, then that’ll be easy to recreate.
You may have noticed the circles in each row are aligned with the center, right? You can reference that when recreating the setup. I’ll explain more later…
Yes, i am referring to the pop it image, but i have a good idea
Instead of creating new code, modify the grid block to shave off extra squares which idk how to do
So, to get it aligned horizontally (same goes for vertically)
Just do \frac{n-1}{2}, times that by the X/Y distance between center to center, then add that to your central position
Then you can just put circles in a row like you do normally
After doing one row, subtract by the distance, then repeat the above for the horizontal alignment, then repeat everything here until all rows have been added.
I don’t understand
That’s actually a pretty tricky grid to make. Maybe try splitting it into three different grids, since there are three square grids that are disaligned with each other.
Hopefully this will make it easier to understand (I even added comments, but it may still be hard to understand. I tried my best to make it as easy to understand as possible)
As you can see, I like making data strings…
I can also modify it so you can define a color as well…
Edit: added some colors
Hi, how about trying the following trick:
Create a square grid, like this one. Then, add a “Donut” shape. Place it in the middle of the square grid and add the following code:
When game starts
Grow by X percent
Set color (White)
Bring to front
If you make the value “X” big enough, you should get a circular grid!
I can make a project showing what I mean if you’d like to:)
Thanks! But how do i stuff code and make the pop it in the center? I want it so the user can pop it (not asking for the pop code, i want to know how to put code in the bubbles)