'go to front' block and 'go back 1 layer' block

2 views
Skip to first unread message

AiBoon Tan

unread,
Jul 2, 2013, 10:05:02 AM7/2/13
to creative-comp...@googlegroups.com
Can anyone help me with understanding the use of these 2 blocks please?

1. Do I have to use these 2 blocks simultaneously? If I have 2 sprites, must I put 'go to front' on the sprite I want to appear in front and at the same time place a 'go back 1 layer' block on the other sprite's script?

2. When must I go back multiple layers? I have seen scripts where the layering is in a double digit number - is it really necessary?

3. When do I need to use a 'forever' block with  'go to front' block or 'go back 1 layer' block?

4. Using Sandy's project  http://scratch.mit.edu/projects/11164135/ as an example, I tried to use both these blocks in order to move  the pictures of the CCOW  facilitation team in front of the earth sprite, but that did not work. 
    I also tried putting 'forever go to front' but that did not work either. Would appreciate some advice and help.

5. Thank you.

Alan Yorinks

unread,
Jul 2, 2013, 10:34:51 AM7/2/13
to creative-comp...@googlegroups.com
Take a look at this program ( I wish I was as talented as this author). http://scratch.mit.edu/projects/10045024/#editor

Notice the layering of the trees as the cat walks and then look at the sprite code. It might give you a hint at what is going on. 

I am not sure if I am knowledgeable enough about this subject, but here is my attempt at answering your questions:

1. If you place a sprite in front, it is now the top layer. You do not have to adjust any other layer unless you want to adjust those as well.

2. People use very high numbers, well beyond the number of  layers actually present to make sure they move the layer to the back layer.

3. This is really dependent upon what visualization you are trying to accomplish. If you have a fixed set of layering in mind, I would do that when I first initialize the program when receiving the green flag. You can put in a loop, but you are just eating CPU time. Not a big deal and in either case will work. But if you wish to change the layering as the program is running, you would need to add the logic either in a loop, or from receiving a broadcast to change the layering.

4. I was not able to quickly remix the program to do what you suggest. I suspect it has to do with the cloning and stamping going on. To clearly understand how this all works, I would write a simple example for myself. Perhaps start with 4 sprites and see if you can adjust the layering. Then you can add cloning and then see how that affects layering. I would do the same with stamping. Finally I would mix both cloning and stamping and see how things are affected. When trying to remix or even debug, it is often very helpful to build a small prototype program so that you can control the number of variables.

Alan

Alan Yorinks

unread,
Jul 2, 2013, 11:29:28 AM7/2/13
to creative-comp...@googlegroups.com
Sorry, this was probably a bad example. To see the effect, create a new project and add several sprites. You will notice that as each sprite is added, it becomes the topmost sprite. If you want to change the layering, go to the script page for the sprite and go to the Looks tab. If the sprite is not the topmost and you want to make the topmost, click on the "go to front block". Then try moving that sprite back 1 or more layers and see the effect.

Let me know if this helps.

Alan
Reply all
Reply to author
Forward
0 new messages