Hey, so basically I have an instance called “tile_mc” (imaginative huh?!) and it is being duplicated using:
for (j=0; j<gridH; j++) {
for (i=0; i<gridW; i++) {
tile_mc.duplicateMovieClip("tile_"+tiles,_root.getNextHighestDepth());
_root["tile_"+tiles]._x = i*tile_mc._width-(i*3);
_root["tile_"+tiles]._y = j*tile_mc._height-(j*3);
}
}
There is more in there, to set up initial variables and so on, but that’s not the problem.
Inside tile_mc there are animations, which show the tile going from one colour to another (as it changes owner). They are labelled: (p0ToP1; p1ToP2; p2ToP1 and so on).
When the user clicks on a tile, the computer takes the variable of the current turn (set to either 1 or 2, depending who’s go it is) and the current colour of the tile (again 1 or 2). It then makes a variable to construct what animation to play:
frameToPlay="p"+_root["tile_"+tileID].colStatus+"To"+"P"+go;
trace(frameToPlay);
_root["tile_"+tileID].gotoAndPlay(frameToPlay);
_root["tile_"+tileID].colStatus=go;
nextGo();
This produces the correct frameToPlay variable, however, the instance that is clicked will only play the animation in the order they are in its timeline. So the tile has to be turned from p0 to p1 then p1 to p2 then p2 to p1 an so on. The code doesn’t seem to let me jump to the correct animation and then run it from there.
Each animation is 20 frames long, frame 1, 20,40 and 60 have the stop action in the timeline.
The game starts with all the tiles owned by p0. If it is player 1’s go, then the first animation works, because the first animation is p0ToP1. However, if I start the game with the go variable set to 2, the p0ToP2 animation doesn’t run.
Hope someone can help.
Jimbobian