In my game using Lua and Gideros studio, I want someone to draw a straight line from mouse down to mouse up. Here is my code that doesn't work:
local function onMouseDown(event)
startx = event.x
starty = event.y
event:stopPropagation()
end
local function onMouseUp(event)
endx = event.x
endy = event.y
local line = Shape.new()
line:setLineStyle(5, 0x0000ff, 1)
line:beginPath()
line:moveTo(startx,starty)
line:lineTo(endx,endy)
line:endPath()
event:stopPropagation()
end
place:addEventListener(Event.MOUSE_DOWN, onMouseDown)
place:addEventListener(Event.MOUSE_UP, onMouseUp)
Anybody know why this isn't working? Thanks!
This is part 2 of my other question.