ActionScript 3 - 2D array for a chessboard -
I am creating a chess game in ActionScript 3 using Flash Professional CC. I have created a chess using the IDE and have put pieces in my initial conditions. Each tile has its own example and its name is its corresponding coordination eg The top left tile is called A8.
The invoices are valid for calculating and thus, I have planned to use two 2D arrays of objects An array should include tile examples A8, B8, C8 , D8 etc. and others to include pieces of the board e.g. BR1, BB1
I have noticed that the action script does not allow anyone to introduce 2D arrays to C ++ (introduces a language); Instead, nested arrays are used. I am a bit confused about how to set up these arrays. What is the most effective method of declaring and starting these arrays (hopefully the duplication code will not be included)?
Welcome to the army of AS3 developers.
Here are some tips for you:
- Arrays can be defined as the
var array: array = [];
and here 2D arrays -var a: Array = [[]];
. Arrays are dynamic objects, you do not need to specify the depth of the array. Therefore, when adding tiles to the array, they are said to be added through thearray [x] [y] = tile
- var myVector: vector & Lt; Tile> = new vector & Lt; Tile> (); and 2d version
var myVector: vector & lt; . Vector & lt; More suggestions:
- Saving
Write tiles in black and library and run-time Grid builds may be better for you.
- Entering the object on the screen by name as an example is a bad idea - lots of work and poor maintenance, besides you will not be able to reach them before the creation of the scene, and you can see them as a dynamic object You have to put them in your required class to work with the general category. It also leads to silent insects, because you will not receive a warning if you compile for some time if you try to use something illegal.
- Saving
Comments
Post a Comment