Drawing Lines without using a Canvas Actor

Non-platform specific questions.

Drawing Lines without using a Canvas Actor

Postby plinydogg » Tue May 16, 2006 10:18 pm

Hi everyone,

I was wondering if anyone knows how to draw a line between two actors without using a canvas.

For example, let's say you've got some moveable units and you want to let the user set their destination when they are tapped on with the stylus (and you also want to let the user check on a given unit's destination by clicking on it). The most obvious way to do this is by drawing a line from the unit to its destination.

The only way I can think of doing this so far is by creating a canvas and setting its visibility state to "DISABLE" when it's created, and then enabling it when the user taps on a unit. But there must be a less cumbersome way right? Also, isn't the line drawn from the upper left hand corner of the event actor (which would make this approach impractical)?

Thanks in advance!
plinydogg
 
Posts: 104
Joined: Thu Aug 25, 2005 8:34 pm
Score: 0 Give a positive score

Postby plinydogg » Wed May 17, 2006 8:07 pm

No one has any idea? Really?
plinydogg
 
Posts: 104
Joined: Thu Aug 25, 2005 8:34 pm
Score: 0 Give a positive score

Postby twobob » Wed May 17, 2006 9:32 pm

The only way other than the canvas actor method I can think of is where you draw a series of dots between two actors.
If there are 2 actors A and B. On mouse down on A to draw a line/dots to B:
Create an actor called movingdot at position A and with actor movingdot do a MoveTo to position B
On the MoveTo function, also create a timer at 25 ms (change this to make dots closer or wider).
On each 25 ms on the timer, create a new actor dot (staticdot) where the movingdot is at its present position while its moving towards actor B
On the event move finish, delete the timer.
Changing the speed in the MoveTo fuction will also affect the distance of dots.
twobob
 
Posts: 33
Joined: Sat Sep 10, 2005 10:29 am
Location: England
Score: 2 Give a positive score

Postby plinydogg » Sat May 20, 2006 1:08 pm

twobob,

Thanks for the help, it worked more or less perfectly!
plinydogg
 
Posts: 104
Joined: Thu Aug 25, 2005 8:34 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest