masking sprite

This forum is currently in read-only mode.
From the Asset Store
Basic template for drawing game with masks and easy customization
  • hi!

    im not sure if this is completely simple or something, but i cant figure out:

    i want to make a sort of mask, where sprite1 is only visible when its overlapping sprite2 and only for the space that is overlapping. so the part that isnt overlapping, is not visible. i guess it sounds weird but i made a picture just to illustrate what im aiming at.

    so basically, it would be a mask effect, but inverted, right?

    is this at all possible, with some creative use of masks and layers?

    any help would be really appreciated!

    thanks for reading.

  • Sounds like you want to make sprite 2 (the darker sprite) have an erase effect on its layer, and the layer below it have that color as the background.

    Then put Sprite 1 on the layer below Sprite 2 (the brown one), and it will show through.

    The top layer where Sprite 2 resides will want to have a white background

  • hi jayjay and thanks for responding.

    im afraid its a little more complicated than that.

    i guess i wasnt making enough sense lol.

    its hard to explain what im trying to achieve, but consider the sprite 1 as a sort of paint and sprite 2 as a part of environment. now, sprite 2 can be pretty much anything, not just one color block, but fully textured piece of environment, set as any possible angle and shape. problem comes because i want to make background environments and objects on layers behind the actual playing area/layer. so basically id like to paint the actual playing area with all kinds of sprites, while still having nice detailed background.

    if im not making sense i can make a better picture to illustrate the masking effect in question <img src="smileys/smiley36.gif" border="0" align="middle">

    EDIT:

    heres a better example of what im trying to do. cant really get any more specific than that :D

    oh and feel free to bask in my incredible artistic awesomeness <img src="smileys/smiley36.gif" border="0" align="middle">

  • Ah okay, so you're kinda painting decals on the ground. Should be possible but I'm not sure how yet...

    Will the decal sprite always be the same kind of texture? If so then you can have the foreground (sprite 2) as a canvas object, then use sprite 1 as a mask to erase from it, and the layer behind has the burn decals/etc. The background would be a tricky part to show again I think.

  • actually im not really sure if it would be the same kind of texture, havent thought that far yet :)

    i was thinking about somehow using the canvas, but i kinda suck using it lol

    this is really puzzling, yet its such a simple concept, to only show overlapping content of a sprite :(

    EDIT:

    also note that it doesnt have to be the same object that is flying or not overlapping the ground, i could live with using separate sprite while the blob is flying and only spawn the mask sprite when it hits the ground.

    if that helps..

    EDIT2:

    actually, i found out a perfect example of what im kind of aiming at:

    Subscribe to Construct videos now

    that was the effect i was going for, although i didnt have excessive gore in mind, but rather just some kind of paint or something. but the effect is the exact same i was looking for.   so, anyone have any ideas?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • well i managed to get something done with the canvas object, example here:

    http://dl.dropbox.com/u/11157144/ground-decal-example.cap

    now it works like i want and i can add all kinds of stuff.

    problem is: theres no way im gonna fill my levels full of canvas objects, cause its so wasteful.

    the solution i had in mind, would be to somehow spawn the canvas and the mask sprite behind it during runtime, when the colision happen. though this opens up alot of new issues. my brain gets stuck, when i need to -on collision- spawn canvas, set angle to correspond the ground sprite angle, detect if the canvas is already spawned etc. overall, just to make a working, efficient system.

    id really like some help from someone wiser than me to overcome these obstacles. im still pretty sure this thing is possible to achieve. thanks!

  • here's a more refined example:

    http://dl.dropbox.com/u/11157144/ground-decal-example2.cap

    i guess it works "pretty well".. theres still some obstacles and restrictions i dont know how to solve.

    in the example, if you try to resize the ground objects and run the layout, the spawned mask canvas doesnt show identical to the ground sprite, the offset is incorrect. is there some trick to know when resizing canvas? how to position it properly after resizing?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)