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

#1 2012-11-09 03:59:58

Gummeah
New Scratcher
Registered: 2012-11-09
Posts: 2

10 sprites move to 10 fixed positions

Hey guys.
Im trying to make script where 10 sprites will appear in fixed positions randomly. One sprite for 1 position.
Have any ideas?

Offline

 

#2 2012-11-09 07:56:52

Gummeah
New Scratcher
Registered: 2012-11-09
Posts: 2

Re: 10 sprites move to 10 fixed positions

And is it possible to bind actions (for example mouse clicking) to a fixed X and Y area?
For example if I click on area from X 1-100 and Y 1-100 then action.

Offline

 

#3 2012-11-09 18:01:36

RCScratch
Scratcher
Registered: 2010-05-26
Posts: 48

Re: 10 sprites move to 10 fixed positions

hmmm

// For every sprite:
when green flag clicked
go to x: (pick random (-240) to (240)) y: (pick random (-180) to (180))

// For the second one, place a hidden sprite at 0,0 and give it this script
when gf clicked
forever //required
 if <<mouse down?> and <(distance to [mouse-pointer v]) < (var)>>
  broadcast [statement v]
  wait until <not<<mouse down?> or <(distance to [mouse-pointer v]) < (var)>>>
 end

Last edited by RCScratch (2012-11-09 18:03:51)


http://i736.photobucket.com/albums/xx7/RCScratch/RCSCRatch.gif http://www.danasoft.com/sig/467044211994.jpg

Offline

 

#4 2012-11-10 14:08:28

Llamalover
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: 10 sprites move to 10 fixed positions

"And is it possible to bind actions (for example mouse clicking) to a fixed X and Y area?
For example if I click on area from X 1-100 and Y 1-100 then action."

For this, I'd do:

if <mouse down?>
   if <a<mouse x<b>> and <c<mouse x<d>
      ...

How you order the different conditions is up to you.

Alternatively, you could create sprites the same colour as the background, and use 'when (sprite x) clicked: ...'

Last edited by Llamalover (2012-11-10 14:08:42)


Be nice, I'm an old lady  wink

Offline

 

#5 2012-11-11 10:26:22

RCScratch
Scratcher
Registered: 2010-05-26
Posts: 48

Re: 10 sprites move to 10 fixed positions

Ok I know but writing it will not be easy

if <<<<mouse down?> and <(mouse x) > (-100)>> and <(mouse x) < (100)>> and <<(mouse y) < (100) > and <(mouse y) > (-100)>
  Statement
end
Technical difficulties prevent this scratchblock from displaying properly
You have to quote it

Last edited by RCScratch (2012-11-11 10:50:47)


http://i736.photobucket.com/albums/xx7/RCScratch/RCSCRatch.gif http://www.danasoft.com/sig/467044211994.jpg

Offline

 

#6 2012-11-11 10:45:43

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: 10 sprites move to 10 fixed positions

RCScratch wrote:

Ok I know but writing it will not be easy

if <<<<<(mouse down?) and <(mouse x) > (-100)>> and <(mouse x) < (100)>> and       <(mouse y) > (-100)>> and <(mouse y) < (100)>>>
 Statement
end

Fixed to some extent.


http://i46.tinypic.com/35ismmc.png

Offline

 

#7 2012-11-14 11:52:56

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: 10 sprites move to 10 fixed positions

If you put a sprite there where the ghost effect is 100 it still responds to the "when sprite clicked" block.


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

Board footer