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

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...