Hello Kirupa Forum,
I am making a flipping card game that allows the player to match two cards etc.
I have got the game working but can not seem to position the cards correctly when they ouput in the .swf file ready for the player to play. I have an idea how I want them to look on screen via a graphical mock-up design but can’t seem to force the 4 x 5 grid to output in these x and y values and then shift and position like the array tells it to.
I basically would like the 16, 24 cards or whatever I choose to output, to start and position at a certain point on the stage and then shift with the declared spacing.
picked_count=0; //number of picks made
h_space = 100; //horizontal spacing between tiles
v_space = 75; //vertical spacing between tiles
//create arrays for tiles and their blockers
tile_array = new Array();
tile_depth=0
blocker_array = new Array();
solution_count=0
//create and initialize each tile and blocker
for(i=0;i<5;++i){
tile_array* = new Array();
blocker_array* = new Array();
for(j=0;j<4;++j){
//increment counter every other iteration
tile_type = Math.floor((tile_depth++)/2);
//attach tile
attachMovie("tile "+tile_type, "t"+i+j, tile_depth);
//place tile in tile array
tile_array*[j] = this["t"+i+j];
//create blocker
attachMovie("tile blocker", "blocker"+i+j, tile_depth+100);
//place blocker in array
blocker_array*[j] = this["blocker"+i+j];
//move tiles and blockers
tile_array*[j]._x = blocker_array*[j]._x = j * h_space + h_space/2;
tile_array*[j]._y = blocker_array*[j]._y = i * v_space + v_space/2;
//assign tile type
tile_array*[j].mytype = tile_type;
//new game, no tiles have been solved
tile_array*[j].solved = false;
}
}
shuffleTiles();
Thanks in advance for any help!