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

#1 2012-08-24 17:21:41

amsteketee
New Scratcher
Registered: 2012-08-24
Posts: 3

Drawing Game

I need to make it so when you click on a certain colored sprite, the pen will change to the color of the sprite you just clicked on (I'm making a drawing program). Any ideas on how to do this??? If you have any clue on how to do this please REPLY!

Thanks so much,
amsteketee  smile

Offline

 

#2 2012-08-24 17:26:03

amsteketee
New Scratcher
Registered: 2012-08-24
Posts: 3

Re: Drawing Game

Please Help!!!!!!!!!!!!!

Offline

 

#3 2012-08-24 19:22:03

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

Re: Drawing Game

On your pen sprite, have this script

when gf clicked
forever
if <<touching [white sprite v]?> and <mouse down?>>
set pen color to [#FFFFFF]
and you do that for each sprite colour

Last edited by zammer990 (2012-08-24 19:22:19)


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

Offline

 

#4 2012-08-25 09:12:49

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

Re: Drawing Game

zammer990 wrote:

On your pen sprite, have this script

when gf clicked
forever
if <<touching [white sprite v]?> and <mouse down?>>
set pen color to [#FFFFFF]
and you do that for each sprite colour

One of the few times that "if touching [] AND mouse down" is probably an acceptable alternative to "when sprite clicked".  I'd make a minor modification:

when gf clicked
forever if <mouse down?>
if<touching [white sprite v]?>
set pen color to [#FFFFFF]
end
if<touching [red sprite v]?>
set pen color to [#FF0000]
end
etc.


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

Offline

 

#5 2012-08-25 09:18:54

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: Drawing Game

@peopleabove I would take an entirely different approach. Here are my scripts:

On your current pen script, add this to the top of your forever:

when gf clicked
set [color v] to [black]
forever
 if <<touching [white v]?> or <<touching [red v]?> or <do this for all of your colors>>>
  pen up
 else
  pen down
 end
 if <(color) = [white]>
  set pen color to [#FFFFFF]
 end
 ^^ Do that for all of your colors
 pen scripts
end
Now, for each color sprite:

when [white] clicked
set [color v] to [white]
I know, it is quite inefficient...


http://i50.tinypic.com/312u714.jpg

Offline

 

#6 2012-08-25 11:37:08

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

Re: Drawing Game

BirdByte wrote:

@peopleabove I would take an entirely different approach. Here are my scripts:

...scripts...

I know, it is quite inefficient...

Yours may be "inefficient", but its pros are fairly good:

1) uses "when sprite clicked" (this is probably closer to what amsteketee wants)
2) provides a variable that contains the color's name.

In an effort to make an even better script ( tongue ), here's my new script:

when gf clicked
set pen color to [#000000]
set [color v] to [black]
forever
wait until <not<mouse down?>>
pen up
wait until <mouse down?>
pen down
if<touching [black button v]?>
set [color v] to [black]
set pen color to [#000000]
end
if<touching [white button v]?>
set [color v] to [white]
set pen color to [#FFFFFF]
end
if<touching [red button v]?>
set [color v] to [red]
set pen color to [#FF0000]
end
etc.
You can simply use a "background sprite" to cover the entire screen except the drawing zone, which will prevent the user from drawing outside of the "drawing zone".

Last edited by MoreGamesNow (2012-08-25 11:39:58)


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

Offline

 

#7 2012-08-28 12:05:37

anirudyak7
New Scratcher
Registered: 2012-08-28
Posts: 2

Re: Drawing Game

Most of the software or the online drawing games use the same tools for drawing effects as in the real world like the pencils, marker, water color, crayons and so on, in order to allow the individuals to create the characters of their preferences.

Offline

 

Board footer