player move to tile
I have a player movie clip and a tile movieclip. When I click the tile movieclip, it adds buttons on the screen. When I click the button, I want the player to go to that tile movieclip that was clicked, however, it isn't working.
function mouseclick(event:MouseEvent)
{
(event.currentTarget as Tile).outline.gotoAndStop("active");
addChild(skip_btn);
skip_btn.buttonMode = true;
////////////////SKIP BUTTON FUNCTIONALITY/////////////////////
if (player.x == (event.currentTarget.x) && player.y == (event.currentTarget.y)) {
skip_btn.buttonMode = false;
skip_btn.gotoAndStop("inactive");
}
else {
skip_btn.gotoAndStop("out");
skip_btn.buttonMode = true;
}
}
if (skip_btn.skipClick == true){
removeChild(skip_btn);
player.x = (event.currentTarget.x);
player.y = (event.currentTarget.y);
trace("MOVE!");
skip_btn.skipClick = false;
}
Basically if a player is on a tile and you click that tile, then the button appears, but it isn't clickable. If you click another tile that the player is not on, then it is clickable and the player should move there, but it doesn't. Any ideas on how to get this to work?
