i want to make a game where the user draws a line. I don’t know how to do it?
Can you tell me how i can do this?
Thank you. [import]uid: 48963 topic_id: 8413 reply_id: 308413[/import]
i want to make a game where the user draws a line. I don’t know how to do it?
Can you tell me how i can do this?
Thank you. [import]uid: 48963 topic_id: 8413 reply_id: 308413[/import]
Hey there,
I know it’s been a few days but if you are still looking to draw a line try inserting this code;
[lua]local function drawline (event)
if event.phase == “ended” then
local myline = display.newLine(event.xStart, event.yStart, event.x, event.y)
myline:setColor(255, 255, 255)
myline.width = 3
end
end[/lua]
Then add a listener to whatever you want them drawing on; if they can draw anywhere then you’d likely do something like this -
[lua]background:addEventListener(“touch”, drawline)[/lua]
Note that the above code is for a standard line - if you want to do a curved line then check out the line drawing code in Martian Control, which you can download from here; http://developer.anscamobile.com/code/martian-control
Peach [import]uid: 10144 topic_id: 8413 reply_id: 30955[/import]