Discuss Scratch

rdococ
Scratcher
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)

TheEpikGamer211
Scratcher
500+ posts

Sprite-local pen

+1
seems like something I'll use.

Epik gamer 211. Proud inventor of GTTSTES.
im workng on
sc (then SBOX)
GTTSTES 1.3
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)
RecessFailsOffical
Scratcher
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”.
I will NOT be active until Sunday Night, I am on a school trip.
If your computer can't see images from Cubeupload, that's not my problem
GEN Z HAS ATTACKED
“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 | do you like my quote in my siggy? tell me on my profile! | why did tfh get deleted yall

American-Armenian

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