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

#1 2009-05-23 05:27:42

dz0
Scratcher
Registered: 2008-12-02
Posts: 17

getting position of other sprites

hello,

could sensing provide coordinates and direction of other sprites on the scene?

then it would be easier to construct some games...


for example, I remember students enjoyed educational activity like
http://en.wikipedia.org/wiki/Robocode
where they could build some primitive AI for gameplay  smile

Offline

 

#2 2009-05-23 05:55:04

Mike_W
Scratcher
Registered: 2009-02-05
Posts: 100+

Re: getting position of other sprites

The way around it is to have the sprite use a variable that is seen by everyone to dump it's current location too

<forever>
<set{  Sprite1X    }to( <x position>)
<set{  Sprite1Y    }to( <y position>)
<wait( 1     )secsc>
<end>

Last edited by Mike_W (2009-05-23 05:57:52)

Offline

 

#3 2009-05-23 06:27:01

MyRedNeptune
Community Moderator
Registered: 2007-05-07
Posts: 1000+

Re: getting position of other sprites

There's a block like that... It's a round sensors block
http://www.imagebeast.net/images/gfsiby5hy613z10ayezn.gif


http://i52.tinypic.com/5es7t0.png I know what you're thinking! "Neptune! Get rid of those filthy advertisements and give us back the Zarathustra siggy, you horrible person!" Well, don't worry about it, the Zara siggy will be back soon, new and improved! ^^ Meanwhile, just do what the sig tells you to. >.>

Offline

 

#4 2009-05-23 08:06:52

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: getting position of other sprites

MyRedNeptune wrote:

There's a block like that... It's a round sensors block
http://www.imagebeast.net/images/gfsiby … 0ayezn.gif

That's what I would usually do. Before 1.2 this block didn't exist and it was really hard to code - especially for me, because I had no idea 1.2 was out until a few months after I joined. My first few projects were all made in 1.1.

Offline

 

#5 2009-05-23 09:44:36

MyRedNeptune
Community Moderator
Registered: 2007-05-07
Posts: 1000+

Re: getting position of other sprites

coolstuff wrote:

MyRedNeptune wrote:

There's a block like that... It's a round sensors block
http://www.imagebeast.net/images/gfsiby … 0ayezn.gif

That's what I would usually do. Before 1.2 this block didn't exist and it was really hard to code - especially for me, because I had no idea 1.2 was out until a few months after I joined. My first few projects were all made in 1.1.

Yeah...  smile  But we're on version 1.3 now, and 1.4 coming soon.  smile


http://i52.tinypic.com/5es7t0.png I know what you're thinking! "Neptune! Get rid of those filthy advertisements and give us back the Zarathustra siggy, you horrible person!" Well, don't worry about it, the Zara siggy will be back soon, new and improved! ^^ Meanwhile, just do what the sig tells you to. >.>

Offline

 

Board footer