A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [CS3][AS3] Painting Game

  1. #1
    Senior Member charlie_says's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    508

    [CS3][AS3] Painting Game

    I'm making a simple painting game, which was going smoothly until I got to working on the erase feature.

    It's not clear how exactly I'd do this, as even using a mask would seem to require being able to remove what I've drawn.

    Anyone got any ideas about how I could approach this.

  2. #2
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    what is your current approach?- do you use bitmapData or instanced Graphics or just plain drawingAPI ?

  3. #3
    Senior Member charlie_says's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    508
    Hey render,

    I have solved this now - I was using only the drawingAPI, but the solution is to use this in conjunction with bitmapData.

    Basically you draw stuff to a temporary shape, copy it to the bmp, then clear the temporary shape. When you draw to the bmp you can 'erase'.

  4. #4
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    that´s what I had in mind as well- though you might test out instancing of graphics so that you can use brush- textures like photoshop does

    the trick is to record the path just like the drawingApi and once you release the mouse button use that path to place the brush patterns along it with equal distances - the more dense the more smooth the result can be.

  5. #5
    Senior Member
    Join Date
    Mar 2008
    Posts
    301
    Have you considered just placing each stroke of the drawing in a separate shape, and setting the blendMode of the erase strokes shapes to "erase"? You can occasionally just do a simple draw of the canvas to a bmd, if you don't want too many shapes hanging around.

  6. #6
    Senior Member
    Join Date
    Mar 2008
    Posts
    301
    Actually render something that I've always been interested in was recreating the brushes that illustrator uses, rather than the photoshop ones. I'm not sure what the best approach is, short of recording the mathematical formulas for the paths of the brush and then shaping them around the drawn path. But ideally I would want something more versatile that that, so I could use bitmaps or whatever else. I thought about using displacement maps, but things seem to get very ugly that way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center