How to do a simple Paint app with paint and erase
|
Hi everyone! Ok, I'd make this into a tut, but I'm not for 2 reasons.
1. It's already in my Karnage Tutorial version 2 (not posted yet).
2. It's only 2 events and 2 active objects.
OK, so here we go. Make two squares, a black one (for painting) and a white one (for erasing). Make sure you have a white background. If not, change the white square to the color of the background. Make the squares between 3 and 10 pixels long and wide. Now, to the programming. For the sake of this, the eraser square is the white square.
PAINT (LEFT CLICK)
Always + repeat when left mouse button is clicked:
CREATE NEW OBJECTS EVENTS:
Create black square offscreen somewhere.
BLACK SQUARE EVENTS:
Set X position to Xmouse
Set Y position to YMouse
Paste into background
Destroy
Erase (RIGHT CLICK)
Always + repeat when right mouse button is clicked:
CREATE NEW OBJECTS EVENTS:
Create white square offscreen somewhere.
WHITE SQUARE EVENTS:
Set X position to Xmouse
Set Y position to YMouse
Paste into background
Destroy
Well, here's a simple paint engine. Tool around with it, add more colors and brush sizes... this is totally expandable. Have fun!
--Karnage
|
|
|