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

#1 2011-09-17 13:30:50

DewleafWolf
Scratcher
Registered: 2011-01-13
Posts: 100+

How to allow drawing in a certain area of the screen only?

It's basic. When mouse is down, the sprite goes to mouse-pointer and pen is down. Else, pen up. The problem is that I want it to only be able to draw within a certain border. Between 166 x and -166 x then between 107 y and -107 y.

Help?  smile

Offline

 

#2 2011-09-17 13:42:52

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: How to allow drawing in a certain area of the screen only?

You would add sensor blocks that would say when or when not to.

It'd look like this:

http://i.imgur.com/uy7ke.gif

Or have a sprite covering up what you don't want shown.


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#3 2011-09-17 13:43:15

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: How to allow drawing in a certain area of the screen only?

If x greater than -166 and less than 166 and y greater than -107 and less than 107 and mouse down pen down
else
pen up.

Offline

 

#4 2011-09-17 13:47:37

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: How to allow drawing in a certain area of the screen only?

There may be a lag error with that script (it'll draw for one frame even if the mouse is beyond the paint-zone).  If it easier to just make a sprite that is the same as the background over what you don't want painted on.  Paint can't go over sprites.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#5 2011-09-17 13:58:41

hmnwilson
Scratcher
Registered: 2007-07-04
Posts: 1000+

Re: How to allow drawing in a certain area of the screen only?

You could do it by making a long string of <>and<> blocks, but it'll likely go past the border slightly, especially on higher pen sizes. I'm guessing you don't want that.

I think the best way to do that is to make a sprite that covers the parts you don't want pen marks on. Because the pen only draws over the background, any pen marks under a sprite won't show.

Does that help?


I'm taking a break from Scratch until 2.0 comes out. Any messages sent between then and now probably won't be read - sorry.
(Oct. 20, 2011)

Offline

 

#6 2011-09-17 14:16:45

DewleafWolf
Scratcher
Registered: 2011-01-13
Posts: 100+

Re: How to allow drawing in a certain area of the screen only?

Thanks for the answers so quickly! I just made a sprite to go over the pen, as suggested.

Offline

 

Board footer