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
If you are looking for solutions and workarounds to the Windows 10 C2 performance issues feel free to reach out to me.

Following rexrainbow's lead - Goodbye.
B
50
S
24
G
14
Posts: 632
Reputation: 12,505

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
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
155
Posts: 2,202
Reputation: 82,485

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.
If you are looking for solutions and workarounds to the Windows 10 C2 performance issues feel free to reach out to me.

Following rexrainbow's lead - Goodbye.
B
50
S
24
G
14
Posts: 632
Reputation: 12,505

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

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
155
Posts: 2,202
Reputation: 82,485

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
22
S
6
G
3
Posts: 718
Reputation: 4,008

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 :)
If you are looking for solutions and workarounds to the Windows 10 C2 performance issues feel free to reach out to me.

Following rexrainbow's lead - Goodbye.
B
50
S
24
G
14
Posts: 632
Reputation: 12,505

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!
If you are looking for solutions and workarounds to the Windows 10 C2 performance issues feel free to reach out to me.

Following rexrainbow's lead - Goodbye.
B
50
S
24
G
14
Posts: 632
Reputation: 12,505

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
22
S
6
G
3
Posts: 718
Reputation: 4,008


Return to How do I....?

Who is online

Users browsing this forum: oosyrag and 7 guests