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

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