DarkByte Posted August 8, 2016 Share Posted August 8, 2016 Is there any way to make an interrupted line? Link to comment
DarkByte Posted August 8, 2016 Author Share Posted August 8, 2016 http://lmgtfy.com/?q=interrupted+line Link to comment
Captain Cody Posted August 8, 2016 Share Posted August 8, 2016 Dotted line?? If so I'll have a function for you in a bit. Link to comment
Captain Cody Posted August 8, 2016 Share Posted August 8, 2016 Quick one, doesn't take into account a lot of things (really not to sure if it works..) but here.. Stuff = {} width = 100 -- "Replace" height = 10 -- "Replace" amountOfDots = 50 -- "Replace" spacing = 2 -- "Replace" widthOfDash = 2 -- "Replace" startPos = 0 startPos2 = 0 function prepStuff () -- PrepTheTables current = 0 currentb = widthOfDash for i=0,amountOfDots do table.insert(Stuff,{current,currentb}) if i == currentb + spacing then current = i currentb = i+ widthOfDash end end end prepStuff () function drawThem() for i,v in pairs(Stuff) do local start = v[1] local tend = v[2] dxDrawLine(startPos+v[1],startPos2,v[1]+v[2],height,tocolor(0,0,0,0)) -- Swap v[1] to startPos2 for vertical end end Link to comment
Captain Cody Posted August 8, 2016 Share Posted August 8, 2016 Check debug. Make sure the values are right etc. Link to comment
Captain Cody Posted August 8, 2016 Share Posted August 8, 2016 Well as I said it was just an example. and probably doesn't work. Build you code off of this. If you cannot I'll get in SA later and make something that actually works. Link to comment
DarkByte Posted August 8, 2016 Author Share Posted August 8, 2016 I'm using a code which draws the circle with dots, I analyzed it and can't understand how to do it with a line. function dxDrawCircle( posX, posY, radius, width, angleAmount, startAngle, stopAngle, color, postGUI ) if ( type( posX ) ~= "number" ) or ( type( posY ) ~= "number" ) then return false end local function clamp( val, lower, upper ) if ( lower > upper ) then lower, upper = upper, lower end return math.max( lower, math.min( upper, val ) ) end radius = type( radius ) == "number" and radius or 50 width = type( width ) == "number" and width or 5 angleAmount = type( angleAmount ) == "number" and angleAmount or 1 startAngle = clamp( type( startAngle ) == "number" and startAngle or 0, 0, 360 ) stopAngle = clamp( type( stopAngle ) == "number" and stopAngle or 360, 0, 360 ) color = color or tocolor( 255, 255, 255, 200 ) postGUI = type( postGUI ) == "boolean" and postGUI or false if ( stopAngle < startAngle ) then local tempAngle = stopAngle stopAngle = startAngle startAngle = tempAngle end for i = startAngle, stopAngle, angleAmount do local startX = math.cos( math.rad( i ) ) * ( radius - width ) local startY = math.sin( math.rad( i ) ) * ( radius - width ) local endX = math.cos( math.rad( i ) ) * ( radius + width ) local endY = math.sin( math.rad( i ) ) * ( radius + width ) dxDrawLine( startX + posX, startY + posY, endX + posX, endY + posY, color, width, postGUI ) end return true end EDIT: The angle amount Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now