Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
op2_sdk:placing_units [2016/01/31 20:43] – vagabond | op2_sdk:placing_units [2016/01/31 21:11] – vagabond | ||
---|---|---|---|
Line 10: | Line 10: | ||
Unit positions are represented in game by either the structure LOCATION or by passing 2 integers into a function, representing the x and y position. LOCATION represents the tile currently being occupied by the unit. The Outpost 2 game engine requires units to be placed +31 X tiles and -1 Y tiles from their actual position. For example: LOCATION(21 + 31, 15 - 1) would be the position (21,15) on the map. | Unit positions are represented in game by either the structure LOCATION or by passing 2 integers into a function, representing the x and y position. LOCATION represents the tile currently being occupied by the unit. The Outpost 2 game engine requires units to be placed +31 X tiles and -1 Y tiles from their actual position. For example: LOCATION(21 + 31, 15 - 1) would be the position (21,15) on the map. | ||
- | |||
- | |||
===== Building Origin ===== | ===== Building Origin ===== | ||
Line 21: | Line 19: | ||
{{op2_sdk: | {{op2_sdk: | ||
<fs small>// | <fs small>// | ||
+ | |||
+ | ===== Vehicle Lights ===== | ||
+ | |||
+ | When any vehicle is created, it defaults to lights off. The function void '' | ||
+ | |||
+ | ===== Using the CreateUnit Function ===== | ||
+ | |||
+ | Some variables used in '' | ||
+ | |||
+ | When placing buildings, the variable rotation does not have any meaning and can be set to any value. | ||
===== Related Source Code ===== | ===== Related Source Code ===== | ||
Line 30: | Line 38: | ||
map_id unitType, | map_id unitType, | ||
LOCATION location, int playerNum, map_id weaponCargoType, | LOCATION location, int playerNum, map_id weaponCargoType, | ||
+ | </ | ||
+ | |||
+ | //Unit.h// | ||
+ | <code cpp> | ||
+ | void DoSetLights(int boolOn); | ||
</ | </ | ||
Line 192: | Line 205: | ||
int InitProc() | int InitProc() | ||
{ | { | ||
+ | // Create a Command Center for player 1. | ||
+ | Unit commandCenter; | ||
+ | | ||
+ | TethysGame:: | ||
+ | commandCenter, | ||
+ | map_id:: | ||
+ | LOCATION(30 + 31, 208 - 1), | ||
+ | 0, | ||
+ | map_id:: | ||
+ | UnitDirection:: | ||
+ | | ||
+ | | ||
+ | // Create an Acid Cloud guard post for player 2. | ||
+ | Unit guardPost; | ||
+ | | ||
+ | TethysGame:: | ||
+ | guardPost, | ||
+ | map_id:: | ||
+ | LOCATION(3 + 31, 2 - 1), | ||
+ | 1, | ||
+ | map_id:: | ||
+ | UnitDirection:: | ||
+ | | ||
+ | // Create a ConVec with a Tokamak Kit for player 2 and turn it's lights on. | ||
+ | Unit conVec; | ||
+ | | ||
+ | TethysGame:: | ||
+ | conVec, | ||
+ | map_id:: | ||
+ | LOCATION(50 + 31, 10 - 1), | ||
+ | 1, | ||
+ | map_id:: | ||
+ | UnitDirection:: | ||
| | ||
+ | conVec.DoSetLights(true); | ||
} | } | ||