Jump to content

Opacity


dferasmus
 Share

Recommended Posts

Dear Panda.js

 

I would like to minimise my usage of images in a little tile based 'gem' game. Its a match three game, as might have be seen in an earlier post.

 

I was thinking of making a few gems and turning them into greyscale - this will reduce the size of each gem as a side benefit. Then Id like to place a colour flood over, or under, the gem using "graphics.drawRect" and make the one on top have a opacity of 50%. Would this work? Will I have a problem with the background? Are there functions like multiply, screen, etc that I could use to only act on non-transparent pixels?

 

Also, I have been looking into text and noticed "game.PIXI.Text". Could I run into trouble with this between devices, such as positioning, scale, hires, and stuff? If I confirm it on one device will it be identical on others? Would it rather be recommended to use bitmap graphics?

 

Thanks

dferasmus

Link to comment
Share on other sites

Hello !

 

You can change the opacity of a sprite, graphic, text, etc via the alpha propertie.

 

Example: 

this.sprite.alpha = 0; // Opacity 0%.this.sprite.alpha = .5; // Opacity 50%.this.sprite.alpha = 1 // Opcatiy 100%.

Then, for the multiply, screen, etc. functions I don't think it's possible without a handmade plugin. :/

 

Also, Enpu said that BitmapText is more optimized than Text. :)

 

Greets,

ThanosS.

Link to comment
Share on other sites

Mr T

 

Thanks, I like bitmap anyway as I can have blood, liquid, fire, candy, cloud, etc fonts if they are bitmap, and I dont have to worry about monospace, so its a win win.

 

I caught wind of pixi.js' tinting which solves my problem perfectly. I have only done a minor test, but it was hugely successful and I suspect I wont have further problems.

 

Example 17

 

Thanks

dferasmus

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...