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

#1 2008-03-18 02:48:07

bernatp
Scratcher
Registered: 2007-03-07
Posts: 49

Freeze block

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

 

#2 2008-03-18 12:34:30

EdnaC
Scratcher
Registered: 2007-08-28
Posts: 100+

Re: Freeze block

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

 

#3 2008-03-19 12:22:09

Violinist
Scratcher
Registered: 2008-02-10
Posts: 10

Re: Freeze block

And yet all those lengthy scripts could be avoided with a simple 'Freeze' and 'Unfreeze' command.

Offline

 

#4 2008-03-23 15:31:47

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

Re: Freeze block

Good idea, but i find that

When I recieve music
forever
if <music=1>
play song "cheese" until done
else
stop script

seems to work just fine.


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

Offline

 

#5 2008-04-01 01:07:31

bernatp
Scratcher
Registered: 2007-03-07
Posts: 49

Re: Freeze block

Yes, but I agree with Violinist, there should be freeze and melt commands, because it's a usual situation when you want to block a sprite (eg. after game over) and it's a too simple problem to use variables, I think.

Offline

 

#6 2008-04-01 03:45:09

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Freeze block

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.


Jens Mönig

Offline

 

#7 2008-04-14 16:44:03

Axeblade
Scratcher
Registered: 2007-09-20
Posts: 37

Re: Freeze block

Here is an easy way to freeze.

<when I receive[ gameover

<stamp>

<hide>

<repeat until> game start

<go to x sad  <x position> )y sad  <y position>

Last edited by Axeblade (2008-04-14 16:44:37)

Offline

 

#8 2008-04-14 16:49:16

Axeblade
Scratcher
Registered: 2007-09-20
Posts: 37

Re: Freeze block

Freeze is just the same as <stop all> , but there is a resume and it only effects the sprite it is placed in.

Offline

 

#9 2008-04-20 10:25:46

likegames
Scratcher
Registered: 2008-03-24
Posts: 100+

Re: Freeze block

can't you just add a freeze & unfreeze block by editing the source code available at http://scratch.mit.edu/pages/source?


There are 10 types of people in this world: Those who understand trinary, those who don't, and those who think this is the same old signature.
Three lines! (and base three!)

Offline

 

Board footer