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

#1 2008-07-01 11:05:18

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Sprite numbering

It would be very nice if you could refer to a sprite by its "sprite #" as we do with costumes (you can ask for <switch to costume happy> or <switch to costume X>).

So, for example, in the

<touching __>
<distance to __>
<__ of __>
<point towards __>
<goto __>

blocks it should be possible to insert a number or a variable.

Would that be "irregular" for Scratch's philophy? Does it pose huge implementation problems that I didn't foresee?

Last edited by s_federici (2008-07-01 11:06:51)

Offline

 

#2 2008-07-03 11:30:13

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Sprite numbering

I don't think it would violate Scratch's philosophy at all! I generally number sprites using:

On stage:

When flag clicked:
set spriteCount to 0
broadcast countSprites

On all sprites:

When I receive countSprites:
set mySprite# to spriteCount
change spriteCount by 1

It never occured to me that Scratch might do this automatically. I thought about this feature, but didn't know how it would work. Would the numbering be based on the order sprites are created? Otherwise it would really mess things up.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#3 2008-07-04 04:25:19

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Re: Sprite numbering

fullmoon wrote:

I generally number sprites using:

On stage:

When flag clicked:
set spriteCount to 0
broadcast countSprites

On all sprites:

When I receive countSprites:
set mySprite# to spriteCount
change spriteCount by 1

This is a nice script. I just saw it and didn't try it yet. Does this numbering follow some criteria/order? 

Also in this case it would be nice to have variables also in blocks  such as

<touching __>
<distance to __>
<__ of __>
<point towards __>
<goto __>

Offline

 

#4 2008-07-04 19:12:43

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Sprite numbering

It seems to sometimes follow the order of sprites' x-positions, but I can't be sure. I sometimes throw in a wait (random 0 to 1) seconds if I need to randomize things.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#5 2008-07-04 19:13:44

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Sprite numbering

And what about (direction to)? This would be a great block because not many Scratch users (including me) are natruals at trigonometry.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#6 2008-07-05 04:45:39

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Re: Sprite numbering

fullmoon wrote:

And what about (direction to)?

What new behaviour would you like to associate to the (direction to) block?

Offline

 

#7 2008-07-05 11:36:01

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Sprite numbering

Nothing, I just want the block!


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#8 2008-07-06 04:26:40

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Re: Sprite numbering

fullmoon wrote:

Nothing, I just want the block!

smile  Yes but... what the new (direction to) block would do once is used? I'm asking this because it seems to me (just looking at its name) that it is very similar to the (point in direction) and (point towards) block. So, what will be the difference between what these blocks do and the new (direction to) block?

Offline

 

#9 2008-07-06 19:09:37

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Sprite numbering

Paddle2See's Pictures Without Handles implements a neat workaround, but basically I want a block that senses how many degrees a sprite has to turn to be pointing towards another sprite. The numbering system would apply to this as well.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#10 2008-07-07 13:40:01

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Re: Sprite numbering

Ok , I undertood. You need a sensing block. Could this work for you? (maybe it is similar to Paddle2See strategy, now I'm going to have a look at it; or it is too simple, but ti worked for my very first attempt)

In Sprite1 (to sense Sprite2)

set oldDirection to (direction)
point to Sprite2
set directionTo to (oldDirection - (direction))
point in direction (oldDirection)

Is this enough for you? Or would you like to have a block for this?

Offline

 

#11 2008-07-07 21:36:09

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Sprite numbering

Well, I'd love the block, but this looks like a great workaround. I suggested it mostly because of Scratch's somewhat confusing direction system.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

Board footer