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
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.
Offline
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
fullmoon wrote:
And what about (direction to)?
What new behaviour would you like to associate to the (direction to) block?
Offline
fullmoon wrote:
Nothing, I just want the block!
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
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.
Offline
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