How To Snap to a Grid

code
howto

#1

This is an updated version of an older topic by me if it seems familiar. (all old topics were deleted)


Have you wanted to make things snap to a grid? It's simple

Just use the following code in an object to do so

Now this puts them on a grid of squares width 100, if you wanted to make the squares bigger or smaller, you would change all the 100's to a different width.
For example, changing all 100's to 50 would make the squares half the width and make the grid squares smaller.


This is in the open-source code so you can use this freely without credit if you want.


Hopscotch Academy - Always accepting new students and teachers!
#2

Nice and simple tutorial! Have you thought of doing this but more like the Hopscotch grid? (meaning you can move the object freely)


#3

Cool tutorial! This is really helpful, great topic :slight_smile:


#4

I tried it, but the square just disappeared.


#5

I haven't thought of that, but it'll probably take some more code with check once if's and such


#6

Wow, that's really cool! Thanks for making a tutorial about it


#7

How can you snap this drill to do that.


#8

I'm sorry, but I don't exactly understand what you mean. Could you explain some more?


#9

thanks for your snap grid