Hi! I would like to build a basic "drawing" app like MS Paint or KidPix, where you move a brush around and it leaves a trail of "ink" (probably a list of points or line-segments).
The brush should be a sprite, but I am not sure how to draw the trail of tiny line-segments that the brush leaves behind. Some ideas:
A) One sprite per line-segment. (Having tons of tiny sprites seems like a lot of overhead.)
B) One sprite for the whole set of line-segments. (Would that mess up collisions, eg, when the brush goes over 1 line-segment, the whole set must be re-drawn?)
C) Use "raw" line-segments instead of sprites. (You shouldn't mix sprites and "raw" graphics, eg, calls to DrawText, see this thread: Mixing sprite.update() and drawText() )
Will you be able to move drawn features, or will it be draw and that’s that (similar to ms paint)? If the latter, I’d think drawing to an image with a context would work well enough
Yes, very minimal, like MS Paint. No selecting or moving of ink once it hits the page.
How does re-drawing work with "bare" images that are not baked into sprites? For example, if the pen sprite passes over an ink image, will the ink image get redrawn afterward?
You'll want to add the canvas image to a sprite with
:setImage(image). The sprite will update when the image changes. You could do it all manually without sprites, but sprites solve so many problems I don't think that would be worth attempting.
Thank you, I'll try that!
In Daily Driver i draw the skid marks this way, directly to the sprite background image.