How do I add color between 4 X,Y points?

Get help using Construct 2

Post » Sat Jun 11, 2016 10:07 pm

I have a layer that is above the other layers. It is only black and white, where the white part of the layer shows what is on the lower layers.

I am aware I can use a sprite, but the white part of the top layer will adjust in size as the game goes on. I don't want to have to make a sprite large enough so it doesn't pixelate when the sprite is at it's larger size. Is it possible to pick 4 X,Y coordinates on a layout and have the game fill in the area with a color? Or will that take up as much CPU/Memory as a large white diamond shaped sprite?
B
62
S
35
G
13
Posts: 230
Reputation: 12,402

Post » Sat Jun 11, 2016 11:25 pm

You can do that with the paster or canvas plugins. Just make either the size of the screen and use their actions to draw the polygon. If you're using webgl then paster will be faster, also with either they take up a texture usually their same size.

If you make a plugin you can do it without the texture as well.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Sun Jun 12, 2016 1:34 am

I usually try not to have plug-ins to try to prevent Issues when exporting to different platforms. I only have one and I hardly even use it. I like to know how to do everything manually. I will look at it though, maybe I can learn from it.
B
62
S
35
G
13
Posts: 230
Reputation: 12,402

Post » Sun Jun 12, 2016 2:06 am

There really isn't a way to do it manually. Well a very hacky way could be to have a square Sprite and a triangle Sprite. Then you take the for points and figure out how to make it out of rectangles and triangles with the requirement that the triangles can't be scaled up.
Another could be to have four scaled sprite with the destination out blend to erase parts of a colored Sprite.

But really those plugins add features that aren't doable with vanilla c2.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Sun Jun 12, 2016 3:04 am

I could use 4 sprites that overlap each other and move each one independently to make it look like a single sprite, It is still rather large in size though. I tried a single large sprite and it said images over 2048 isn't always supported in other systems. I didn't want to use a ton tiles(since they are the wrong shape) and I am seemingly unable to have tiled-backgrounds on different frames. Thanks. I will try a different method instead. I will explain what I came up with when I come up with it.
Last edited by Unconnected on Mon Jun 13, 2016 8:49 pm, edited 1 time in total.
B
62
S
35
G
13
Posts: 230
Reputation: 12,402

Post » Sun Jun 12, 2016 3:37 am

I figured out how to use tile-maps to fake it. I am able to stack two tile-maps and erase on contact.
Last edited by Unconnected on Mon Jun 13, 2016 8:51 pm, edited 1 time in total.
B
62
S
35
G
13
Posts: 230
Reputation: 12,402

Post » Mon Jun 13, 2016 2:55 am

Using tilemaps sounds inefficient for that. Here's the way to do it using a layer and four sprites with the destination out blend.
https://dl.dropboxusercontent.com/u/542 ... _quad.capx
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Mon Jun 13, 2016 8:40 pm

I already have it done. I just made two tile-maps into half of an isometric grid and put them on each other to make a whole, I removed blend and added erase tiles on contact. I'm using a large invisible object to erase on contact, this prevents visual problems. I was trying to avoid many objects since the area that needed to be a solid color is large. To prevent visual problems I would probably need to use 8 or even 16 objects, at that point I might as well just render large tiled objects for the ground instead of using tiled background and remove the black/white blend layer.

I thought tile-maps didn't take up much CPU/ memory vs objects?

Is it better performance wise to have 8/16 of the same objects, or 2 tile-maps that repeat the same single tile to make the black area outside of where the diamond is supposed to be?
I'm not sure how each is processed, seems to me tile-maps uses less of everything somehow.
Is there a huge difference or should I just tile objects for the ground and forget the black/white mask?
B
62
S
35
G
13
Posts: 230
Reputation: 12,402

Post » Mon Jun 13, 2016 11:24 pm

Okay, now that I am able to look at the example, I can see that the Aliasing isn't as bad as I though it would be.

You did it a different way than I was expecting.
I was expecting object copies that moved in a single 4-way direction depending on the need, basically tiled objects.


Thanks, Will try it out.
B
62
S
35
G
13
Posts: 230
Reputation: 12,402


Return to How do I....?

Who is online

Users browsing this forum: ChoosyZerk, jorgmaquoi and 32 guests