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

0 favourites
  • 9 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • 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?

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

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

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • I figured out how to use tile-maps to fake it. I am able to stack two tile-maps and erase on contact.

  • 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

  • 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?

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

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