Allow player start position to be set.

This commit is contained in:
Steve 2015-11-22 11:41:28 +00:00
parent b61369b57f
commit 3b7d8ff940
1 changed files with 6 additions and 0 deletions

View File

@ -215,6 +215,12 @@ static void loadPlayer(cJSON *node)
player->x = (GRID_SIZE * GRID_CELL_WIDTH) / 2; player->x = (GRID_SIZE * GRID_CELL_WIDTH) / 2;
player->y = (GRID_SIZE * GRID_CELL_HEIGHT) / 2; player->y = (GRID_SIZE * GRID_CELL_HEIGHT) / 2;
if (cJSON_GetObjectItem(node, "x"))
{
player->x = (cJSON_GetObjectItem(node, "x")->valueint * GRID_CELL_WIDTH);
player->y = (cJSON_GetObjectItem(node, "y")->valueint * GRID_CELL_HEIGHT);
}
if (strcmp(type, "Tug") == 0) if (strcmp(type, "Tug") == 0)
{ {
battle.stats[STAT_TUG]++; battle.stats[STAT_TUG]++;