Jump to content

Phaser bitmap does not multiply sprites


PabloK
 Share

Recommended Posts

Hi I'm trying to make a basic lightning system using bitmap multiply. How ever I'm having trouble with the fact that the bitmap does not darken my sprites. How would I achieve this?

I create the bitmap like so in the game.create function.

  // Shadow
  this.bitmap = this.game.add.bitmapData(
    this.game.width+100,
    this.game.height+100
  );
  this.lightBitmap = this.game.add.image(0, 0, this.bitmap);
  this.lightBitmap.blendMode = Phaser.blendModes.MULTIPLY;

I then fill it and paint it every frame in the update function.

  this.bitmap.fill(20, 20, 20, 1);
  this.lightBitmap.x = this.camera.x-50;
  this.lightBitmap.y = this.camera.y-50;
  this.bitmap.dirty = true;

Here is an image that shows what happens. I painted the shadow on half screen only to illustrate that it does not darken the sprites. The dirt tiles and the purple player are the sprites I want it to affect.

PhaserBitmapProblem.png

 

How can I make it darken the sprites as well?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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