Hi,
I am trying to draw a line using newRect between two points.
I have been trying to use the rotation to get the angle right but am doing something wrong… does anyone have any code snippets? or can someone tell me what I am doing wrong? (I can’t use the newline method, I need to use the newrect)
[code]
local diffX = Startx - EndX
local diffY = Starty- Endy
local sizeofLine = math.sqrt (math.pow(diffX,2) + math.pow(diffY,2) ) – use pythagoras
local angleofLine = math.deg (math.tan (diffY/diffX)) – use Tan = opp.adj
angleofLine = 90 - angleofLine – work out the rotation angle
Line = display.newRect( Startx, Starty, 10, sizeofLine )
Line:rotate(angleofLine)
[/code] [import]uid: 67619 topic_id: 19375 reply_id: 319375[/import]