private static void LoadEnemy(String entity, PlayableMainGameScreen PGS) { char[] delims = { '<', '>' }; String[] tokens = entity.Substring(8).Split(delims); String texture = tokens[1]; float posX = float.Parse(tokens[3]); float posY = float.Parse(tokens[5]); String filename = tokens[7]; EnemyEntity npEntity = new EnemyEntity(texture, new Vector2(posX, posY), filename); PGS.AddEntity(npEntity); }
private static void LoadPlayer(String player, PlayableMainGameScreen PGS) { char[] delims = {'<','>'}; String[] tokens = player.Substring(8).Split(delims); String texture = tokens[1]; PlayerEntity pEntity; Vector2 playerPos = PGS.PlayerPos; pEntity = new PlayerEntity(texture, playerPos); PGS.AddEntity(pEntity); }
private static void LoadPlayer(String player, PlayableMainGameScreen PGS) { char[] delims = {'<','>'}; String[] tokens = player.Substring(8).Split(delims); String texture = tokens[1]; float posX = float.Parse(tokens[3]); float posY = float.Parse(tokens[5]); PlayerEntity pEntity; Vector2 playerPos; if (PGS.PlayerPos.Equals(new Vector2(-1, -1))) { playerPos = new Vector2(posX, posY); } else { playerPos = PGS.PlayerPos; } pEntity = new PlayerEntity(texture, playerPos); PGS.AddEntity(pEntity); }