Sign in to follow this  

Masking sprite a to sprite b.

Recommended Posts

First of all what i am trying to do:

Imagine a fiery ball that goes near thing that make them appear lighter...

i am trying to make a glowing ball that blends with certain objects. So imagine a scene in which there is a background, some other stuff, and rocks. A glowing ball follows mouse with opacity halfed. now this ball of light needs to blend in addition to being opaque with rocks and not with background and other stuff.


My approach:  not saying it's the best but i intended to make two glow balls one that was opaque and one that would blend with objects and would remain masked out other wise. It's mask would be all object that it need to appear on.


But there is not a way i can find to do it.


I would like to have a group of sprites to which i can masks this so this firy ball only appears when it's over them.


doing this gives error



Share this post

Link to post
Share on other sites

Real new to all this but I was having this same question and got something to work.


You could use alphaMask to use another sprite as a mask:


If you really want to use 'mask' you could create a graphic and use that to mask.


    masked =; // This group holds all masked objects
    bg = masked.create(0, 0, 'pic'); // add all your elements here


    // Set up the mask
    bgMask =, 0);
    bgMask.drawCircle(0, 0, 90);

    masked.mask = bgMask; // mask it



Probably a terrible approach for a full game. If you can use webGL you might want to check out all the filters out there like this one:

Share this post

Link to post
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.

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.