Hi I have the following questions.
1) is t possible for a sprite to broadcast its position?
2) is it possible to dynamically create new sprite at run time?
thanks Letizia Jaccheri
Offline
artentnu2009 wrote:
Hi I have the following questions.
1) is t possible for a sprite to broadcast its position?
2) is it possible to dynamically create new sprite at run time?
thanks Letizia Jaccheri
1) Yes.
<when green flag clicked>
<forever>
<set{ x }to( <x position>
<set{ y }to( <y position>
<broadcast[ new position
<end>
<when I receive[ new position
<say[ <{ x }> ]for( 2 )secs>
<say[ <{ y }> ]for( 2 )secs>
Offline
On dynamically creating a sprite - No. If Servine's answer isn't what you're after (saying/thinking my position), you may want the functionality of the sensing block that has two pull-downs. On the right, you pull down a list of all of the project's sprites, on the left, the list will have the position of that sprite, its direction, and its "for this sprite only" variables. This lets other sprites detect position etc., of the sprite you're interested in.
Offline
Servine wrote:
<when I receive[ new position
<say[ <{ x }> ]for( 2 )secs>
<say[ <{ y }> ]for( 2 )secs>
Acctually you could just do
<when I receive[ New Postion
<say[ <x position> ]for(2 )secs>
<say[ <y position> ]for(2 )secs>
Offline
Snowdrift wrote:
Servine wrote:
<when I receive[ new position
<say[ <{ x }> ]for( 2 )secs>
<say[ <{ y }> ]for( 2 )secs>Acctually you could just do
<when I receive[ New Postion
<say[ <x position> ]for(2 )secs>
<say[ <y position> ]for(2 )secs>
I don't think he's trying to get the sprite to report it's own position.
Offline