Round Brush Tool

BlitzMax Forums/BlitzMax Programming/Round Brush Tool

FBEpyon(Posted 2008) [#1]
I have been trying to make a round brush tool for my terrain editor, but I can't seem to figure it out.

I have tried sin/cos and some other things, but there no luck to my madness. Is there anyone that can help?


Damien Sturdy(Posted 2008) [#2]
Dude, I already helped- i gave you the code to do it, you just needed to find a 2D distance function in the code archives??

Radius=4
For X=cursorx-radius to cursorx+radius
	for y=cursory-radius to cursory+radius
		addheight=(radius-distance2D(x,y,cursorx,cursory))/Radius
		heightmap[x,y]=heightmap[x,y]+addheight
	next
next

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Distance func (nipped from Shagwanas code entry and modified for you!

Function Distance2D(x1,y1,x2,y2)
	xDelta=abs(x2-x1)
	yDelta=abs(y2-y1)
	Return Sqr((XDelta*XDelta)+(YDelta*YDelta))
End Function 



FBEpyon(Posted 2008) [#3]
you know I looked and I couldn't find it, sorry :P but I was seeing if there was anyone else that could help also :P


Damien Sturdy(Posted 2008) [#4]
Well, that should do what you need. Do you understand it? :D


FBEpyon(Posted 2008) [#5]
yep thanks and it works prefect!!