Discuss Scratch
- DarkFusion
-
10 posts
Pen layer/Sound pan
Ok, I think these are two fairly reasonable and logical suggestions that could easily be implemented, however I don't believe they are possible in Scratch as of now.
Looking at the amazing progress Griffpatch has made on this project (http://scratch.mit.edu.ezproxyberklee.flo.org/projects/17783489/), I think that adding a few simple blocks could work wonders.
First, I propose adding a “set pen layer” block.
This would allow pens to draw behind (certain) sprites as well as on top of sprites. I have personally wanted this for a long time, but believe that (for example) griffpatch could greatly benefit from this as players could be simple sprites that could be drawn over with a pen if they become partially occluded. It just seems natural that the pen shouldn't be limited to drawing behind sprites.
Secondly, I propose a “set sound pan” block.
This would accept a value from -1.0 to 1.0 and set the pan of playing sounds to that pan. For example, a pan of 0 would be normal (100% on left and right), a pan of -1 would be full left, and a pan of 1 would be full right. While this may not be quite as immediately practical as a “set pen layer” block, there still are many uses for this, one of which would be simulating 3D sound (for advanced users). This would be an amazing addition to multiplayer projects using cloud variables as a player who is to the left/right could make a sound panned to the left/right to indicate they are there (walking, shooting, or whatever).
I really hope that some of the scratch team could see (and maybe add) these! I'd love for them to be added.
Looking at the amazing progress Griffpatch has made on this project (http://scratch.mit.edu.ezproxyberklee.flo.org/projects/17783489/), I think that adding a few simple blocks could work wonders.
First, I propose adding a “set pen layer” block.
This would allow pens to draw behind (certain) sprites as well as on top of sprites. I have personally wanted this for a long time, but believe that (for example) griffpatch could greatly benefit from this as players could be simple sprites that could be drawn over with a pen if they become partially occluded. It just seems natural that the pen shouldn't be limited to drawing behind sprites.
Secondly, I propose a “set sound pan” block.
This would accept a value from -1.0 to 1.0 and set the pan of playing sounds to that pan. For example, a pan of 0 would be normal (100% on left and right), a pan of -1 would be full left, and a pan of 1 would be full right. While this may not be quite as immediately practical as a “set pen layer” block, there still are many uses for this, one of which would be simulating 3D sound (for advanced users). This would be an amazing addition to multiplayer projects using cloud variables as a player who is to the left/right could make a sound panned to the left/right to indicate they are there (walking, shooting, or whatever).
I really hope that some of the scratch team could see (and maybe add) these! I'd love for them to be added.
- TheLogFather
-
1000+ posts
Pen layer/Sound pan
For the first suggestion, see this topic - I think having the ability to put the pen into a different layer would be effectively included in that.
- DarkFusion
-
10 posts
Pen layer/Sound pan
Oh yeah, that would probably fit there, my bad.
However, my second suggestion still stands.
However, my second suggestion still stands.
- TheLogFather
-
1000+ posts
Pen layer/Sound pan
Wasn't suggesting you shouldn't post this Oh yeah, that would probably fit there, my bad.

Indeed! Would be really interesting to be able to do it. Not sure if Flash has that level of control over sounds, though? Also, if you have different sounds playing at the same time, you may want them to be panned differently - and I suspect it's not possible to control the pan of individual sounds in that way? (It'd have to be global, assuming even that much is possible…) However, my second suggestion still stands.
I guess you could work around it by having a set of sounds in your project that have different pans. Then you can choose the one that's appropriate for the situation. That'll work more generally, and it's probably not that hard to do (if you have a reasonable sound editor installed on your machine), even though it'd mean extra resources to upload/download with all those sounds.
- DarkFusion
-
10 posts
Pen layer/Sound pan
Not sure if Flash has that level of control over sounds, though?
It appears to have that capability:
http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d1f.html
- JonathanSchaffer
-
1000+ posts
Pen layer/Sound pan
the blocks:

set layer to (1 v)::penbut the layers will also have a limit like clones do.
clear layer (1 v)::pen
clear layer (all v)::pen

ah, good point Support, but the layers should also have a limit like clones do.
Last edited by JonathanSchaffer (Jan. 14, 2017 18:12:47)
- Inreal49
-
100+ posts
Pen layer/Sound pan
Support, but i want to add something can be usefull
delete layer [1 v]
add layer
- alexphan
-
1000+ posts
Pen layer/Sound pan
Support, but the layers should also have a limit like clones do.
- ngnhc
-
100+ posts
Pen layer/Sound pan
Semi-support.
This would make working with pen easier, but I don't see it being needed much.
You could simulate these layers just based on the order in which you draw objects.
(Items you draw first are on the bottom, items you draw last are on the top.)
Also what makes the ‘clear layer all’ different from the current ‘clear’ block?
This would make working with pen easier, but I don't see it being needed much.
You could simulate these layers just based on the order in which you draw objects.
(Items you draw first are on the bottom, items you draw last are on the top.)
Also what makes the ‘clear layer all’ different from the current ‘clear’ block?
- JoshyRobot
-
25 posts
Pen layer/Sound pan
Support!
The problem with ordering your code to draw on layers is that for large scale projects, a single pen sprite can become unmanageable quickly. This could solve that problem by allowing separation of code without a major framerate drop. Each sprite could draw a designated section while keeping the order of the layers the same. Currently, you would have to use a pen layering system that makes each drawing sprite wait until the previous was finished. This cut my framerate in half without even drawing anything. If things are drawn, they flash a LOT
doing this.
As for the clear layer all, it simply replaces the clear block, so there isn't a redundant block.
Semi-support.
This would make working with pen easier, but I don't see it being needed much.
You could simulate these layers just based on the order in which you draw objects.
(Items you draw first are on the bottom, items you draw last are on the top.)
Also what makes the ‘clear layer all’ different from the current ‘clear’ block?
The problem with ordering your code to draw on layers is that for large scale projects, a single pen sprite can become unmanageable quickly. This could solve that problem by allowing separation of code without a major framerate drop. Each sprite could draw a designated section while keeping the order of the layers the same. Currently, you would have to use a pen layering system that makes each drawing sprite wait until the previous was finished. This cut my framerate in half without even drawing anything. If things are drawn, they flash a LOT
doing this.
As for the clear layer all, it simply replaces the clear block, so there isn't a redundant block.
- JonathanSchaffer
-
1000+ posts
Pen layer/Sound pan
good question, nothing, I am suggesting the replacement of it. what makes the ‘clear layer all’ different from the current ‘clear’ block?
- ngnhc
-
100+ posts
Pen layer/Sound pan
The problem with ordering your code to draw on layers is that for large scale projects, a single pen sprite can become unmanageable quickly. This could solve that problem by allowing separation of code without a major framerate drop. Each sprite could draw a designated section while keeping the order of the layers the same. Currently, you would have to use a pen layering system that makes each drawing sprite wait until the previous was finished. This cut my framerate in half without even drawing anything. If things are drawn, they flash a LOT
doing this.
It is possible to create a pen project that uses multiple sprites to simulate pen layers without a frame rate drop.
It just requires an understanding of the script execution order of sprites. When multiple sprites have scripts that respond to the same event, the sprite on the topmost layer runs its script first, then others are run until the sprite on the bottommost layer runs its script. So, if you have a broadcast received by multiple sprites that all contain a loop that renders an image with each execution, pen layers are simulated without requiring a ‘wait system’.
This gives a more detailed explanation of execution order.
Here is a project that implements this idea with different sprites drawing different objects. It does require a ‘wait system’ at the start to make sure all the sprites' layers are set correctly.
- kenny2scratch
-
500+ posts
Pen layer/Sound pan
Some block mock-ups:
clear layer (1 v) :: pen
clear layer (all v) :: pen
pen down on layer (1 v) :: pen
pen up on layer (1 v) :: pen
the following blocks are just normally in the block palette, no change needed
set pen color to [#0000ff]
set pen color to ()
change pen color by ()
set pen shade to ()
change pen shade by ()
set pen size to ()
change pen size by ()
- MeIzAwezomeDede
-
1000+ posts
Pen layer/Sound pan
I come from a dupe. I support this fully, here's what I said in the dupe:
Much support from me, this would literally help so much with Pen projects. Imagine the new 3D games that would be made!
Also, these might go well with the suggestion, but idk:set pen layer to [front v] :: pen //Drop-down, would set pen layer above all sprites
set pen layer to [back v] :: pen //Drop-down, would set pen layer behind all sprites
set pen layer to [sprite1 v] :: pen //Drop-down, would set the pen layer to the layer of the sprite selected
change pen layer by (...) :: pen //Would change the pen layer by ...
- MrFluffyPenguins
-
1000+ posts
Pen layer/Sound pan
support because i made a duplicate of this topic
also there's literally no downsides to having this, it would make pen projects much more common
also there's literally no downsides to having this, it would make pen projects much more common
- DarkFusion
-
10 posts
Pen layer/Sound pan
Glad this is still getting support 6 years later lol
- gosoccerboy5
-
1000+ posts
Pen layer/Sound pan
Lol Glad this is still getting support 6 years later lol