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

#1 2012-06-17 07:01:11

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Grid snapping problem

I'm using the grid snapping script (round x/y) * y and i've hit a problem. When I use it it's fine for some, then it begins to go offset, moreso the further from the edge I get.. Any ideas why?


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#2 2012-06-18 16:34:13

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

Re: Grid snapping problem

upload your project and post a link to it and someone will take a look at it  smile

Offline

 

#3 2012-06-18 17:46:00

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Grid snapping problem

Make sure the value for what you're calling "y" is equal to either the width or the height of the costume (depending on whether your script is snapping to x- or y-positions.  For example:

when gf clicked
set [Width v] to [20]
set [Height v] to [30]
forever
set [CurrentMouseX v] to (mouse x)
set [CurrentMouseY v] to (mouse y)
set [DestinationX v] to ((round((CurrentMouseX) / (Width))) * (Width))
set [DestinationY v] to ((round((CurrentMouseY) / (Height))) * (Height))
go to x: (DestinationX) y: (DestinationY)
end

Last edited by amcerbu (2012-06-18 17:47:58)

Offline

 

Board footer