So I’ve created a script where a mc is clicked on and the player can draw a path using the mouse. I’m trying to figure out how I can get the mc to follow the path drawn out by the player’s mouse and when the player clicks again, it erases all of the path
my code is below
import flash.display.Sprite;
import flash.events.MouseEvent;
var clip:Shape = new Shape()
addChild(clip);
var mouse:Sprite = new Sprite
addChild(mouse);
ship1.addEventListener(MouseEvent.MOUSE_DOWN, activate);
function activate (evt:MouseEvent) {
stage.addEventListener(MouseEvent.MOUSE_MOVE, drawLine);
}
function drawLine(evt:MouseEvent)
{
clip.graphics.moveTo(mouse.x, mouse.y);
clip.graphics.lineTo(mouseX, mouseY);
clip.graphics.lineStyle(2, 0xff9933);
mouse.x = mouseX
mouse.y = mouseY
}