Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
An array of player starting positions on the map. |
Overview
When you start a game, you see starting positions shown on the map preview – 'startPositons' is an array of Position objects defining the co-ordinates of those starting positions.
The array indexes are position numbers, not player IDs. So startPositions[0]
returns a position object for starting position 0.
To work out what position a particular player is in, use:
startPositions[playerData[playerID].position]
You can use start positions to get an idea of where player bases are on the map. Note, however, that players (especially humans) might choose to build their base (or some of it) somewhere else on the map.
Properties
Each (numerically referenced) element in the array contains an object that defines the x,y of a starting position on the map.
Property | Type | Description | Game Version |
---|---|---|---|
x | Number | The x co-ordinate of the player's starting position | 3.1 Beta 1 |
y | Number | The y co-ordinate of the player's starting position | 3.1 Beta 1 |
type | Constant | POSITION | 3.1 Beta 11 |
Examples
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
// work out what position I started in var myStartPosition = playerData[me].position; // now get the map coords of that position var myStartXY = startPositions[myStartPosition]; // trace to console console("Position "+myStartPosition+" at (x,y): "+myStartXY.x+","+myStartXY.y); |
Div | ||
---|---|---|
| ||
The array index is not the player ID, it is the position ID on the map. |
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Div | ||
---|---|---|
| ||
See alsoRelated articles:
|