masking sprite

For questions about using Classic.

Post » Thu Sep 06, 2012 10:22 pm

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.
B
4
S
2
G
2
Posts: 109
Reputation: 1,318

Post » Fri Sep 07, 2012 6:51 pm

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
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Sat Sep 08, 2012 12:43 pm

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

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 clodius6662012-09-08 13:12:07
B
4
S
2
G
2
Posts: 109
Reputation: 1,318

Post » Sat Sep 08, 2012 3:25 pm

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.Jayjay2012-09-08 15:27:56
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Sat Sep 08, 2012 4:24 pm

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:

http://www.youtube.com/watch?v=nedYP-tE930

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? clodius6662012-09-10 16:17:13
B
4
S
2
G
2
Posts: 109
Reputation: 1,318

Post » Tue Sep 11, 2012 11:24 am

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!
B
4
S
2
G
2
Posts: 109
Reputation: 1,318

Post » Tue Sep 11, 2012 4:14 pm

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?
B
4
S
2
G
2
Posts: 109
Reputation: 1,318


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests