Jump to content

Darkening, lightning with textures


mariogarranz
 Share

Recommended Posts

I have a couple of textures in my game, whole black and whole white, with the game dimensions. I use them in some parts of the game with alpha tweenings to make the scene go darker or flash effects.

 

I thought it was stupid to have 2 big textures with a plain color, so I reduced them to a single pixel texture and scaled them inside the game. Now the antialias is messing, making kind of a gradient effect from the borders to the inside of the game screen.

 

What would be the best approach to make this effect without having to use a full screen texture? Any ideas?

 

Thanks in advance :)

Link to comment
Share on other sites

  • 3 months later...

You can use BitmapData to draw huge rectangle with JS.

 

Watch this:

Solid Rectangle - http://www.html5gamedevs.com/topic/7620-draw-solid-rectangle/?hl=rectangle

Graphics Example - http://examples.phaser.io/_site/view_full.html?d=display&f=graphics.js&t=graphics

 

Hope it helps, I'm going to use this effect too :)

 

It's funny how it looks like AS3.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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