Please send any questions about brush scripts, but the basic idea is start with a skeleton of:
function main(x, y, p)
return 0
end
Then add whatever code you need into main to accomplish your desires.
... and I know that's worse then saying "draw a stick figure, then add all the details to draw what you want", but without a more specific direction (or at least an art style) that's about all you can say.
A better starting skeleton might be something like:
lastDrawX = 0
lastDrawY = 0
firstDraw = true
function main(x, y, p)
local width = bs_width()
local updateDist = width
if not firstDraw then
local distance = bs_distance(lastDrawX - x, lastDrawY - y)
if distance < updateDist then
return 0
end
end
local r, g, b = bs_fore()
local opacity = bs_opaque() * 255
bs_ellipse(x, y, width, width, 0, r, g, b, opacity)
lastDrawX = x
lastDrawY = y
firstDraw = false
return 1
end
... and replace the bs_ellipse with whatever you want to do.
Alternatively, start with one of the examples at
d.hatena.ne.jp/MDIAPP/20100311Warning: brush scripts can do amazing things, but they have limits, in the same way computer-generated music is still mostly terrible compared to human-composed music - they can only work within the one layer, they do not work well, if at all, with bitmaps, and they can be slower than other brushes. There are probably other limitations also.