Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Make sprites snap to grid when dragged
- CodeySnail
-
21 posts
Make sprites snap to grid when dragged
Please see this for more info:
https://scratch.mit.edu/projects/65206216/#player
I am trying to make it to where, for the sounds, when you drag them on the board after you press G then the clones will snap to a grid. I already made the drag-n'-drop feature, but I don't know how to make them snap to a grid. Is there a way you can do this?
I was thinking of where there is a square sprite. Then, it clones itself all over the board for a grid. When the other music sprites drop onto the board, then the user can press G and then a variable will be set off. From then on, if the user drops the sounds onto the board, then the sounds will set their x an y value to the grid square's x and y value.
How do you do this in a working way?
https://scratch.mit.edu/projects/65206216/#player
I am trying to make it to where, for the sounds, when you drag them on the board after you press G then the clones will snap to a grid. I already made the drag-n'-drop feature, but I don't know how to make them snap to a grid. Is there a way you can do this?
I was thinking of where there is a square sprite. Then, it clones itself all over the board for a grid. When the other music sprites drop onto the board, then the user can press G and then a variable will be set off. From then on, if the user drops the sounds onto the board, then the sounds will set their x an y value to the grid square's x and y value.
How do you do this in a working way?
- Sigton
-
1000+ posts
Make sprites snap to grid when dragged
Use this script:
w
Sigton
w
Set X to whatever you want the grid size to be, the bigger the number the bigger the grid. I normally do mine between 8 and 32, but not normally much larger. Hope I was of service,
Sigton
- CodeySnail
-
21 posts
Make sprites snap to grid when dragged
Thanks! I'll see if that works out!
- Discussion Forums
- » Help with Scripts
-
» Make sprites snap to grid when dragged