How To: Snap To A Grid (simple)

Ever wanted blocks on a grid? Now you can!
##1. Create a text object and put this code in.

##2. Make a new value (in this case, it’s ‘X’). Make a new rule in the same text object with this code.

##3. Now make another text object and new value (here, the second value is ‘Y’)

##4. To have something drag to a grid, add this rule to the object dragged.

##Of course now,##
you can change things up. The “100” in the first rules is how wide the squares of the grid are. You can change them to any other, but make sure all of the numbers are all equal.
##Happy Hopscotchin’ :wink:##
Note: This works because Hopscotch doesn’t get too precise when measuring sizes of objects.


couldn't you just directly set X and Y to last touch X and Y /100?

1 Like

If it was
last touch X/Y ÷ 100 × 100
it would make a regular drag effect (object right under finger).
With this code, it make a grid effect because the size block automatically rounds to the nearest whole number.
(So yeah, try it out)


Yey revive.
good topic guitar of the fishy.

1 Like

Thanks AwesomeNachos :D

With the update adding in the round operation block, I was planning to improve this tutorial but never got around to it. I probably should lol


Figtars the old

The old


I am old lol

I've been here since August 6th, the first time the forum was out of beta testing or whatever

1 Like