This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-08-04 09:06:27

Flashkirby
Scratcher
Registered: 2007-08-04
Posts: 3

How do I make a snap to grid in Scratch?

How do I make a drag and snap to grid in Scratch because im making this game which I need to know how to do that  sad
Please could someone help?  hmm

Last edited by Flashkirby (2007-08-04 09:08:16)

Offline

 

#2 2007-08-04 09:20:12

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: How do I make a snap to grid in Scratch?

To snap to 5 pixel grid, at the end of your drag and drop script:

Go to ( 5* (round ((x)/5)), ( 5* (round ((y)/5))

Change all four "5"s for the grid-size you want, or replace them with a variable if you want to easily experiment with different grid sizes.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

Board footer