The TRANSPARENCY Extension! šŸ‘ļøā€šŸ—Øļø

Thank you, I’ll add tinting to the next update! :+1:

2 Likes

That is an AMAZING suggestion, I’ll add that in the next update!

You’re right thank you for the reminder :laughing:
(I’m perpetually at 3000 characters, this is going to take some squeezing in)

WOW thank you I would love to see how it turns out! :blush:

Firstly, there is a better extension for simple shadows (here– it’s better because its optimized to just shade every color closer to black by 1 so its faster and looks better if you just want a shadow effect)
Secondly, the new Cache feature from Richard’s suggestion (in the next update) seems to absolutely improve the performance!

1 Like

@richard, I tried using this extension with little game I started, and it said it’s incompatible with:
Arcade-sprite-transitions
Arcade-sprite-events
Arcade-extension-utils

What makes those extensions incompatible with this? And also what on earth is extension utils I never downloaded that.

1 Like

tbh, that extension doesn’t have the greatest performance either, and it even warns you that the more of the screen is shaded, the laggier it gets. I had wanted to add shadows to every plant and zombie in my pvz, but that’s probably not a good idea…

2 Likes

super cool stuff!

2 Likes

ah, right, i need to fix that…

extension utils is an extension that i use internally as a dependency in all of my extensions. the reason you get this incompatible message is because some of my extensions use different versions. i’m going to go update all of them right now, though, to make this issue go away.

4 Likes

okay, i have now fixed the versions in all of my extensions! @YamJam you might need to update the versions of the extensions in your project; i think the arcade-screen-transitions was probably the culprit

6 Likes

@randomuser does it only work on tile’s? i can’t get it to work

1 Like

The ā€˜make transparent’ block can’t take a variable as an opacity, it will just take the current value of the variable and not update.
So since want to update the opacity based on the time since start, I put the block in a ā€˜forever’ loop! :slight_smile:

would this add an opaque option in drawing? (like walls that can be placed over tilemap squares but for sprites) how would this work?

1 Like

thanks @randomuser, does the transparent only work on like tiles? cuz when i put my mouse under the dock that you fixed i can’t see my sprite

1 Like

Version 2 is here! :partying_face:

The support in just the first few days of this extension have been absolutely wonderful, I’m so grateful that people are finding use in it and contributing so much to its further development! :smiling_face_with_three_hearts:
I’ve decided to release version 2 with some requested features so you can get started right away on using them, with a version 3 planned shortly to add the more complicated performance upgrades (and any more requests)

This update adds:

  • Caching (Thanks to Richard)! By ā€˜caching’ a certain opacity to memory, any transparent sprite using that opacity will have greatly improved performance. Try it out to reduce lag!
  • Overall performance upgrades (by using bitshifting to obtain the color pallete and not loading unused variables), also thanks to Richard!
  • The ā€˜tint’ block, to shade sprites a certain color, such as @WoofWoof 's suggestion to tint sprites blue in a waterfall! It is also good for maintaining the readability of a semitransparent sprite on a complicated background or applying a tint regardless of the background color.
  • The ā€˜partial’ transparency block, to make only one color of a sprite transparent, such as @kirbob 's suggestion to make only the wing color of a fly transparent! I’d love to hear other ways you would want to specify what part of the sprite should be transparent or not. :eyes:

Stay tuned for the next update with:

  • More work on the caching system for more performance improvemenets!
  • Possibly supporting transparent sprites showing other sprites beneath them?
  • More specific partial transparency blocks (Such as adding transparency to multiple colors, a geometric region of the image, or a region specified by another image) if you all want that or other specifications!
  • And any more suggestions you have or problems you need to solve for your game-- just reply here and I’d be happy to help! :blush:

The link to the extension is the same, and the demo at the top of the thread has been updated to show off the new effects!

8 Likes

Currently, you can’t see other sprites through transparent sprites, but I am adding that feature in verison 3 soon! :head_shaking_vertically:
If I can get Richard’s solution to work, you could see anything on the screen through the transparent sprites (so it would also include particles, chat bubbles, drawing to the screen, etc) and improve performance
However at the very least I can add a block to make certain sprites, types of sprites, or all sprites visible through transparent sprites manually; I mention making only certain sprites visible because if I can’t get Richard’s method to work then every sprite that has to be factored into the transparent sprite would damage the performance
So I’ll let you know soon, either way it will be added, but it may or may not affect the lag!

4 Likes

I currently have the block specify a certain color to be made transparent, but I’d love to hear how you want to specify the transparent areas so I can add that too!
I don’t think I can edit the built-in image editor to let you draw a red overlay on the opague pixels though, so the closest solution I have is to have you make a separate image with those red pixels. Then if the original image’s pixel matches the position of a red pixel in the second image, it is opaque, and if it doesn’t it is transparent. It’s the same method you described but it’s difficult because you would have to draw the sprite and the overlay separately.
I’m also adding a few more types of partial transparency which will be easier to use!

3 Likes

I think the ā€œover (milliseconds)ā€ functionality would be cool for opacity some animations.
Like in the color fading extension, but with your transparency opacity:

    /**
     *  Create a Fade from the current palette to end that occurs over the given duration
     */
    //% blockId=colorStartFadeFromCurrent block="fade to %end||over %duration ms"
    //% weight=79
    //% duration.shadow=timePicker
    export function startFadeFromCurrent(end: Palette, duration = 2000) {
        startFade(currentPalette(), end, duration);
    }
1 Like

you always could make a functio nyourself but this added functionality could be useful