Game Development Community

Drawing Lines with the Mouse

by Affectworks · in Torque Game Builder · 11/29/2007 (7:01 am) · 6 replies

In TGB, what method could be used to draw lines like the photoshop 'paintbrush' tool?
For games like an InkBall or Line Rider.

#1
12/12/2007 (1:06 pm)
Bump - if clarification of my question is needed please feel free to ask.
#2
12/12/2007 (1:10 pm)
I believe there are some simple primitive drawing tools, but I don't know if there's much on that level.
#3
12/14/2007 (12:17 am)
I suggest creating a simple drawin program by using mouse events to spawn small rectangles on the screen. A simple version of this could be overriding the "on mouse down" event to create a rectangle every coupld milliseconds. I don't think this is neccessarily the fastest way to do it memory-wise, but it's certainly doable. If you want some more help just reply to this post, I will do my best to respond quickly.
-nic
#4
12/14/2007 (3:37 pm)
It should be possible to modify the engine. It can draw lines when defining a path, surely it can render lines. Has anyone modified the engine to do this?

If the lines are straight you can stretch a sprite the length of the line so that it's a single object. Curved lines are where this strategy fails.
#5
04/21/2008 (9:31 pm)
One possible method is to (I'm assuming that you are envisioning a Mario Paint/simple Photoshop type situation) use particle effects that tail behind the mouse pointer but instead of fading the particle effects remain where the mouse has traveled. Also, you can mess around with onMouseOver (I believe thats what the behavior was called) to flip tiny images (for instance, all images are white to start. as the mouse travels, the tiny white images along the path of the mouse are flipped to a tiny black image - pseudo pixels so to say). It's late and that's just off the top of my head.
#6
04/14/2009 (6:07 am)
this is something that I am interested in as well, one of the games I have in the works will use the mouse cursor or your finger (Iphone) to draw different types of lines that the main character will use to complete a level... very similar to "Kirby Canvas Curse" for the nintendo DS. I really want to find a way to use my own "ink" sprites for the lines and since they won't always be straight then Nikos' post will be of no use in implementing something like this, but it is a good idea.