gideros

Lua Gideros: Line with touch 2

和自甴很熟 提交于 2019-12-23 04:52:18
问题 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

Lua Gideros: Trouble drawing line with touch

99封情书 提交于 2019-12-10 11:56:16
问题 In my Game using Gideros and Lua, I want players to be able to draw a straight line from the point they touch the screen until the point they release. However, when I try run this code, I always get an error message. Here is the code: local function onMouseDown(event) event.x = startx event.y = starty event:stopPropagation() end local function onMouseUp(event) event.x = endx event.y = endy event:stopPropagation() local line = Shape.new() line:setLineStyle(5, 0x0000ff, 1) line:beginPath() line