# How to Make a Super Fast Shape Grid!

Hello everybody!
Today, I will be showing you how to make a super fast and easy grid in Hopscotch! Believe me, anyone can make this! Let’s start!
First, put when game starts. Make a variable called x and y. Set those variables to the starting position of the first shape. Next, create the number of clones in the grid plus 1. If I want to make a chess grid, I would make 65 clones. If I was making a sudoku, I would make 82 clones.
Then, put when object is cloned, set image to the object you want. Put set position x to the variable x and y to the variable y. Then check once if clone index is 1, make it invisible.
We are almost done. Create another variable called Squares in a row. Put check once if Squares in a row = the number of shapes across, then set Squares in a row to 0, set the y variable to y variable minus the amount of space you want the shapes to be, and set the variable x to the starting x position. Here’s pictures of the code:

If you have any questions, tell me and I can answer it for you!

17 Likes

Thanks, this topic is so helpful

###### first post 🙂🙂
7 Likes

there’s a faster method by Petrichor but this is good for people who don’t want to use Petrichor’s

5 Likes

Yes, but for me that’s kind of hard and long a bit.

2 Likes

Thanks so much!
I literally want to learn how to make these stuff!
(But, are there a shorter version? )

3 Likes

This is by @Petrichor. You can use his way or mine.
Look in square code I don’t want to do that much code so I made this.
5 Likes

Unsure if the method I used is similar to Petrichor’s method, but…

I used [Set Position to x (((Self Clone Index % length) × size) + corner offset x) y (((round((Self Clone Index ÷ length) - 0.5) × size) + corner offset y)]

clone index % length: position x of clone will reset back to the corner offset x after going over the max length (if you know how modulo works, this would be easy to understand)

Size is self explanatory

Corner offset: position of the original object (usually bottom left corner)

(round((clone index ÷ length) - 0.5): Increase Y after the index goes over the max length. The minus 0.5 is to prevent unintended y increments. Can be replaced with floor(clone index ÷ length), which does the same thing… I think.

Your method for fast grid loading is awesome as well, but I find the method I used to be a bit easier for me (not by much).

3 Likes

Nice!

2 Likes

The part that makes grid loading faster is (When (original object total clones) < (max clones)), which will increase the clones exponentially and not go over the limit.

2 Likes

This works! And with surprisingly simple code.

1 Like