Game Walking Function Help

Hello you good people, you!

Well I need someone to help me on a flash function, and it has to be a function. I’m on a very big scale project and it is a game. What I need done is a walking version, but not just some easy script for it. It’s like there are 545 diffrent buttons in my game, and each other has a diffrent location. Now what I want to do is to use a function for moving between them. Here is an example screenshot of the location where you can move:

http://vert.2webh.com/all.jpg

The numbers aren’t there in the real game off course, it’s for the button number. Now what I want to do is that you click the button, and the move function is called. The function should be like:

  • The movieclip that should move is a player, instance name is ‘character’
  • You move to the x and y positions of the button you’ve clicked.
  • The movement speed should be a variable, you make the name up, just be sure I can edit it by changing 1 value
  • The character must move through a good line, meaning if you are at position #16 and you want to go to 31, it first goes to 32 and then to 31 and not directly to 31
  • There’s a big Array (its called _root.takenArray ) and it checks Every spot where you have to move to (if you move from 16 to 31 it checks 31 and 32) it checks if the values of _root.takenArray[31] and _root.takenArray[32] are not bigger than 1
  • If you’re moving to 31 from 16 and _root.takenArray[32] (in other words, spot 32) is taken, it tries to find another route, like through 15 and then to 31. If there is one, it follows that route.
  • If they are bigger than 1, The moving action shouldn’t be done, if they aren’t bigger than 1, move the player

All the spots of above are positioned like in http://vert.2webh.com/all.jpg

That’s all. Sounds complicated doesn’t it? Well I’m pretty advanced at actionscript and I couldn’t manage to make it work.
Can someone please help me one this, write it? I will be in your debt forever and I’ll do what I can to repay you!

Using actionscript 1.0