Discuss Scratch

500+ posts

Sprite-local pen

I've read a few suggestions for pen layers over the last few years and I've wondered to myself, “this would be very useful, but isn't it too complicated?” Sprite layers are already convoluted to deal with for new users, and another set of layers that interweaves the existing set sounds like a bad idea.

After some thinking, I realized the biggest (only?) use case for pen layers is dynamic sprite rendering, i.e. when a sprite isn't just a set of fixed graphics but something whose display needs to be dynamic, like a HP bar or a line between two sprites. There's a simpler way to support this use case.

erase all on [stage v] layer :: pen
erase all on [sprite v] layer :: pen

bring pen to [stage v] layer :: pen
bring pen to [sprite v] layer :: pen

The stage pen layer remains the same - pen draws on top of the stage, beneath everything else, and that layer is shared with all other sprites. The sprite pen layer is localized and always rendered on top of the sprite doing the drawing, although it does not move with the sprite. Mouse events would fire on the local pen layers as if they were part of the sprite.

This feature offers a lot of bang for its buck compared to other ‘pen layer’ suggestions. It's less immediately obvious what the blocks do, but pen projects become much less complicated to set up. No more broadcasting every sprite to render in the reverse of actual sprite order, nor doing geometry & communication to figure out when the mouse clicks a sprite, you can just program pen projects exactly the same way as you program regular projects as well as interweave pen-based sprites with normal sprites.

Last edited by rdococ (Dec. 19, 2023 18:12:03)

1000+ posts

Sprite-local pen

seems like something I'll use.

Epik gamer 211. Proud inventor of GTTSTES.
im workng on
sc (then SBOX)
when (::ff0000) horribly misclicked and pressed @greenFlag instead.:: hat :: events 
Summon Evil Kumquats using (((((((((((((:D):: motion):: motion):: motion):: motion):: motion):: motion):: motion):: motion):: motion):: motion):: motion :: motion)
1000+ posts

Sprite-local pen

Semi-support. This.. is useful but adds a little more complications to pen.

highlight (double click) a piece of text + control (command if on mac) + shift + down arrow key to see my full “siggy”.
If your computer can't see images from Cubeupload, that's not my problem
You are reading the post of someone who isn't active on the forums very much (until August 2024) :*(
“Some people can read War and Peace and come away thinking it's a simple adventure story. Others can read the ingredients on a chewing gum wrapper and unlock the secrets of the universe.”

cool stuff: 500th post | an awesome suggestion made by moi | an awesome controversial suggestion also made by moi | gen z has attacked | why did tfh get deleted yall


Hi! I'm @RecessFailsOffical. This is my signature, where I am allowed to advertise, blockspam, etc. It goes under every post I make. I know I spelled Official wrong in my username because I made this account when I was like 2. I'm in 6th Grade, I like coding and I want to be a software developer when I grow up.
Pronouns: He/Him or any pronouns as long as I'm not referred to as “Gibson”, “she/her”, or “TommyInnit”.

Powered by DjangoBB