Jump to content

How do you update BitmapData ?


wordyAllen
 Share

Recommended Posts

Hello,

I'm trying to render  a dynamic bitmap shadow, similar to this example:

 

I'm trying to replicate it using the shadow method:

 

Here's what I have (I think the problem is on line 44):

 

 I guess my question is, how do you update BitmapData  ? Any help is appreciated. 

 

Thanks! 

 

Link to comment
Share on other sites

I got it!  (well dr.hayes in the salck channel got it)  In case anyone want to add  dynamic shadows to your images.... you have to redraw the bmd in update() . check the codepen for an example. 

function update () {

  offset = moveToXY(game.input.activePointer, sprite.x, sprite.y, 8);
  bmd.clear();
  bmd.shadow('rgba(0, 0, 0, 0.5)', 5, offset.x, offset.y); 
  bmd.copy('shape')
  
}

 

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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