How can I create a line while dragging with the mouse?
Develop games in your browser. Powerful, performant & highly capable.
Hey beguinner!
Depends. There are some ways you could do that. One of them is using the canvas plugin to draw the line. Another one would be to have a very small square sprite and set its width and angle according to the mouse position.
The .capx below shows the second method I mentioned above.
https://www.dropbox.com/s/tyvhmhfxcli12 ... .capx?dl=0
Hope it helps. Cheers!
very nice, thanks. do you think it's possible to draw zigzag lines without releasing the mouse button?
Yes its possible, but there should be a way to tell when to zigzag. I wouldn't recommend that it creates a new line when you change direction (even though its possible) because of usability issues.
In the following example, you can zigzag by right-clicking, without releasing the left button. Does this work for you?
https://www.dropbox.com/s/l1so4t4lkznup ... .capx?dl=0
Cheers!
Hi, and if you want to draw curves lines with the feft clic :
https://www.dropbox.com/s/cmvt757hgw0fa ... .capx?dl=0