From: ?ryD on
Hello,

it's me again,

I would like to ask if you can draw a line between two sprites without using the coordinates of those sprites.

like;
a line sprite(10) and sprite(11)
From: Andrew Morton on
?ryD wrote:
> if Origin="Hill", PointA="Tree", PointB="Rock", End="River" then

Director will not understand what you mean by the commas.

Presumably you mean

if Origin="Hill" and PointA="Tree" and PointB="Rock" and End="River" then

Andrew


From: Andrew Morton on
?ryD wrote:
> Hello,
>
> it's me again,
>
> I would like to ask if you can draw a line between two sprites
> without using the coordinates of those sprites.
>
> like;
> a line sprite(10) and sprite(11)

You can use sprite(10).loc to avoid typing in the actual numbers.

See also .locH, .locV, .left, .top, .right, .bottom, .width, and .height.

Andrew


From: ?ryD on
[q][i]Originally posted by: [b][b]Newsgroup User[/b][/b][/i]
You can use sprite(10).loc to avoid typing in the actual numbers.

See also .locH, .locV, .left, .top, .right, .bottom, .width, and .height.

Andrew


[/q]

Thanks for the help about the sprite(#).loc script. I'll try that when I get a
trun at the PC. I had to learn about that comma thing the hard way.

will the script look like this?
on enterframe
movie.stage.image.draw(sprite(#).loc, sprite(#).loc, rgb(150,0,0))
end

From: Mike Blaustein on

> will the script look like this?
> on enterframe
> movie.stage.image.draw(sprite(#).loc, sprite(#).loc, rgb(150,0,0))
> end
>

That code will work. It will redraw the line on every enterFrame event,
and it will not remove it, so it will look like a whole lot of lines if
the things are moving. Instead of drawing directly onto the stage
image, you can put a backgroundtransparent image on the stage and draw
onto that. Then it can have code to make it blank before drawing on it.
That way you have more control over it. Also, you might want to use
this syntax to get a little more control over the rendering of the line:


movie.stage.image.draw(sprite(#).loc, sprite(#).loc,
[#color:rgb(150,0,0),#shapetype:#line,#linesize:1])

(watch for inadvertent line breaks... that should be a single line of code)

The point is that this way you can easily control the type of line drawn
and the width of it. as well as the color.