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

#1 2010-08-12 18:26:28

nipit1
New Scratcher
Registered: 2010-08-02
Posts: 4

How to get sprite 1 to know other sprites' X & Y

With multiple sprites how do you "broadcast" to the other sprites their X & Y coordinates? This is for a simple click sprite 1 and click sprite 2...they swap locations.

Offline

 

#2 2010-08-12 18:34:48

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: How to get sprite 1 to know other sprites' X & Y

use these blocks:

http://img709.imageshack.us/img709/1570/blox.gif


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#3 2010-08-12 19:22:32

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: How to get sprite 1 to know other sprites' X & Y

Like ScratchREALLYROCKS said, those sensor blocks will detect locations, costume, and a lot more.


Hai.

Offline

 

#4 2010-08-12 19:33:02

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: How to get sprite 1 to know other sprites' X & Y

fg123 wrote:

ScratchREALLYROCKS

Why does everyone mess my username up?


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#5 2010-08-12 19:38:37

MabonBaladevaKain
Scratcher
Registered: 2010-07-25
Posts: 80

Re: How to get sprite 1 to know other sprites' X & Y

I just made something that uses broadcasts.
You could take a look at that. Just click on my name.
It's the one about collisions.

The other is my first Scratch project that I made just before so check that out too if you want.

Offline

 

#6 2010-08-12 22:15:32

pika100chu
Scratcher
Registered: 2009-07-26
Posts: 500+

Re: How to get sprite 1 to know other sprites' X & Y

As ScratchReallyROCKS said, just use those blocks.

Offline

 

#7 2010-08-13 11:24:26

nipit1
New Scratcher
Registered: 2010-08-02
Posts: 4

Re: How to get sprite 1 to know other sprites' X & Y

Is there a more efficient script than:
x of sprite 1 < x of sprite 2  or x of sprite 1 > x of sprite 2 or y of sprite 1 is < y of sprite 2 or y of sprite 1 is > than y of sprite 2

in order for sprite 1 to know where to go
with many sprites this is cumbersome
thanks

Offline

 

#8 2010-08-13 12:41:43

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: How to get sprite 1 to know other sprites' X & Y

nipit1 wrote:

Is there a more efficient script than:
x of sprite 1 < x of sprite 2  or x of sprite 1 > x of sprite 2 or y of sprite 1 is < y of sprite 2 or y of sprite 1 is > than y of sprite 2

in order for sprite 1 to know where to go
with many sprites this is cumbersome
thanks

Not quite sure what you mean...


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#9 2010-08-13 12:57:36

samurai768
Scratcher
Registered: 2009-07-21
Posts: 1000+

Re: How to get sprite 1 to know other sprites' X & Y

nipit1 wrote:

Is there a more efficient script than:
x of sprite 1 < x of sprite 2  or x of sprite 1 > x of sprite 2 or y of sprite 1 is < y of sprite 2 or y of sprite 1 is > than y of sprite 2

in order for sprite 1 to know where to go
with many sprites this is cumbersome
thanks

You could make a variable, and have it set the variables to the x position and y postition, and put this script:

When I recieve (Switch Posititions)
Go to x: variablex1 y: variable y1

When I recieve (Switch Posititions)
Go to x: variablex2 y: variable y2

On both sprites. I hope that helped!

Offline

 

#10 2010-08-14 07:48:34

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: How to get sprite 1 to know other sprites' X & Y

nipit1 wrote:

Is there a more efficient script than:
x of sprite 1 < x of sprite 2  or x of sprite 1 > x of sprite 2 or y of sprite 1 is < y of sprite 2 or y of sprite 1 is > than y of sprite 2

in order for sprite 1 to know where to go
with many sprites this is cumbersome
thanks

Can you put that into blocks?
Its really hard to know what people mean when they just describe blocks like:

"when flag clicked forever repeat 10 if momentum = 2 move momentum * 6 steps else play sound 1 glide 1 secs to x momentum y join 1 variable2 move distance to sprite2 if on edge bounce"

And especially since you did not describe what it actually did.

Last edited by colorfusion (2010-08-14 07:50:04)

Offline

 

#11 2010-08-14 17:48:35

nipit1
New Scratcher
Registered: 2010-08-02
Posts: 4

Re: How to get sprite 1 to know other sprites' X & Y

thanks folks, i think i got it working

Offline

 

Board footer