It's possible that some people have already written the idea of a freeze block.
It'd be good if we could freeze and melt a sprite (something like lock or unlock, it would have 2 states). But, freezing a sprite would mean that all of its hats would be passive, not sensing keypressing, etc.
Now, it's a bit tricky to make a sprite 'unmoveable' after game over, for instance (with lots of if-s under every hat and a 'logical' variable). And it's quite usual.
Offline
I "freeze" sprites quite often, in the sense that they aren't moving or reacting, though I usually hide them as well.
This can be done by having a local variable ("Active" would be a good name for it) that is set to 0 if the sprite is "frozen" or "locked", and to 1 otherwise. The scripts for the sprite can be loops that examine the value of the variable.
When I recieve "StartSprite1"
Set Active = 1
Show
Broadcast "RunSprite1"
When I recieve "RunSprite1"
Forever if <Active = 1>
'
(Do things)
'
If Damage > 3 ---"Damage" is another variable
Hide --- You could omit this if you don't want to hide the sprite.
Set Active = 0
If the sprite gets damaged (or whatever causes it to "freeze"), all of the scripts that are like this will stop running. I do have one example of a project where a sprite "freezes" using this method: http://scratch.mit.edu/projects/EdnaC/81934, this is a turn-based game, so the sprites that aren't active remain on screen but aren't controlled.
Hope this helps.
-MrEd
Last edited by EdnaC (2008-03-19 12:14:01)
Offline
I agree with barnatp that freeze / melt blocks would sometimes be very useful.
Another useful idea would be to provide a blocks that make use of Scratch's lock/unlock mechanism to make sprites draggable/undraggable with the little paddlock symbol on them.
Offline
can't you just add a freeze & unfreeze block by editing the source code available at http://scratch.mit.edu/pages/source?
Offline