Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Objects opacity [ANSWERED]

edited November 2011 in Suggestions Posts: 437

It would be amazing to have objects opacity, like the Z-Value...what do you think?


  • SimeonSimeon Admin Mod
    Posts: 5,782

    You should be able to set this now, juaxix

    fill( r, g, b, a )
    stroke( r, g, b, a )
    tint( r, g, b, a )

    You can call tint( 255, 255, 255, 128 ) to make a sprite 50% transparent, for example. The same applies to fill and stroke.

  • edited November 2011 Posts: 437

    I knew is just a would be nice to refer an object and so on...thanks for woke me up :D

  • Posts: 437

    when you say now is in the new version?

  • BortelsBortels Mod
    Posts: 1,557

    Now as in today - go look at the "Dungeon Roller" example, which does sprite transparency effects.

  • Posts: 437

    yes, that's the point, i used that example in the Asteroids game also...but i was thinking in something more easy to understand and use...

  • BortelsBortels Mod
    Posts: 1,557

    Keeping in mind that they can't just change the API if they made an odd choice in design, because they'd break existing code, this is an ideal place to wrap it with something you find more appealing.

    function spriteAlpha(a)
        tint(255, 255, 255, a)

    then spriteAlpha() fills the same role stroke() and it's friends do. Or, just override the sprite() call itself, adding the optional parameter.

  • Posts: 437

    Very clever, thank you

Sign In or Register to comment.