How do I paint within a mask?

  • I'm a beginner working on a game for my kids who like to "paint" on the screen. I'm going to create a "mask" - black and white version of the image, say a car, and then enable them to select a color and "paint" the area they want to... to make it easier I don't want the paint to work outside the masked area.

    I have found the tips on drawing using lines vs just following the mouse pointer, but I haven't found any way to use a tile or a sprite as a mask so that the paint only stays in the enclosed area. See http://www.cartoonito.co.uk/tv-show/fir ... nting-game but imagine this as painting not a "paint bucket like fill".

    Ideally, I'd like to just stop the paint stroke if it hit a black line in an imported image, so I don't have to "code" each image individually.

    Any ideas or examples you've seen?

    D.

  • I guess you could try using blendmodes for this..

  • Great idea LittleStain... it works, but I can't find an easy way to "import" a new image. I have to create a new sprite for every image. I can't just import a black and white JPG, SVG or BMP.

    That's why I was hoping to use the "mask" idea... so I'd import an image as a mask and that would be all that could be painted.

    Make sense?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So what you could do..

    Draw inside the lines

    This is far from perfect and pretty intensive because of the amount of sprites created, but it shows how combining blendmodes and effects can create the effect you're aiming for..

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