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

#1 2011-11-29 16:11:22

G0D_M0D3
Scratcher
Registered: 2011-11-28
Posts: 1000+

Gridsnap help

I need a gridsnap script that will fit a multible-costumed sprite. All costumes are 12x12

I need:

- When clicked, to stamp
- To move the sprite to the mouse on the gridsnap
- Not touch the edges

I will give credit to anybody who can help me, even if you didn't do the final script.


I made a MC texture pack! Get it at planetminecraft!
http://i.imgur.com/0EG0u.png

Offline

 

#2 2011-11-29 16:42:46

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Gridsnap help

Making a grid is nice and easy:

round(mousex/(grid square size x value) ) * (grid square size x value)
round(mousey/(grid square size y value) ) * (grid square size y value)

In your case, the grid square size x and y are 12.

Your script would look something like this:

When green flag clicked
clear
forever
|| go to ( round (mousex/12) * 12 ) (round (mousey/12) * 12 )
|| if <touching edge>
|| || hide
|| else
|| || show
|| || if <mouse down>
|| || || stamp
end


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#3 2011-11-29 16:44:40

Ratty1967UK
Scratcher
Registered: 2007-05-16
Posts: 88

Re: Gridsnap help

here's somthing to get you started...

enjoy!

http://scratch.mit.edu/projects/Ratty1967UK/2183843

Offline

 

Board footer