How do I Cutout circle sprite

Get help using Construct 2

Post » Tue Sep 19, 2017 11:48 pm

Hi folks,

How would I go about taking a square sprite, and cutout a circle? I realize sprites are square, but I essentially want to turn a square image into a circle (erasing the rest of the sprite). This needs to be dynamic. I took a peak, but I did not see any hits on the forum...has anyone accomplished this already?

For example:

If I had an image of a black square, the resulting sprite would be a black circle on screen.

Thanks
B
45
S
18
G
8
Posts: 510
Reputation: 8,515

Post » Wed Sep 20, 2017 1:30 am

You can put a black sprite with a round transparent hole in it on top of your square sprite.
Set blend mode on that black sprite with a hole to "Destination out".
Both sprites should be on a separate layer I think.

I made an example for another post, but it should give you an idea:
Image
Check out my awesome game Doptrix
B
17
S
9
G
50
Posts: 829
Reputation: 27,967

Post » Wed Sep 20, 2017 11:47 am

dop2000 wrote:You can put a black sprite with a round transparent hole in it on top of your square sprite.
Set blend mode on that black sprite with a hole to "Destination out".
Both sprites should be on a separate layer I think.

I made an example for another post, but it should give you an idea:
Image


Interesting. I was under the impression that blends did not work across all platforms, is that correct?

What if I have something below and above the sprite? I see your background works well, but what if there is something ontop too ?

Very interesting concept. Ill need to play around with it, it has potential.
B
45
S
18
G
8
Posts: 510
Reputation: 8,515

Post » Wed Sep 20, 2017 12:59 pm

"What if I have something below and above the sprite?"
I haven't tested this much, but I think it only affects sprites on the same layer.
Check out my awesome game Doptrix
B
17
S
9
G
50
Posts: 829
Reputation: 27,967

Post » Wed Sep 20, 2017 6:57 pm

Hey @humanescape!

1. Put the image and the round mask on a layer. Mask over fill.
2. Set the layer Force own texture attribute to YES.
3. Set the mask Blending mode attribute to Destination in.

Example: https://www.dropbox.com/s/gvip9zojy0ggo ... .capx?dl=0

Hope this helps. Cheers!
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
20
S
6
G
3
Posts: 624
Reputation: 3,750

Post » Wed Sep 20, 2017 10:11 pm

brunopalermo wrote:Hey @humanescape!

1. Put the image and the round mask on a layer. Mask over fill.
2. Set the layer Force own texture attribute to YES.
3. Set the mask Blending mode attribute to Destination in.

Example: https://www.dropbox.com/s/gvip9zojy0ggo ... .capx?dl=0

Hope this helps. Cheers!


You da man! Thank you :)
B
45
S
18
G
8
Posts: 510
Reputation: 8,515

Post » Thu Sep 21, 2017 12:20 am

Got it working! Make sure when you do your transparent piece, it is a complete cutt-out. I had weird behaviour and found it was because the cuttout was not perfect color on the outside (it was not completely "hard")

Thanks again!
B
45
S
18
G
8
Posts: 510
Reputation: 8,515

Post » Thu Sep 21, 2017 11:14 am

Glad to help!
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
20
S
6
G
3
Posts: 624
Reputation: 3,750


Return to How do I....?

Who is online

Users browsing this forum: blackhornet and 25 guests