public LanternPlatform(int xLocation, int yLocation) : base(xLocation, yLocation) { itemType = new LampI().GetType(); goodGraphic = Textures.textures["lanternPlatform"]; badGraphic = Textures.textures["lanternPlatform"]; }
public void continueGame() { StreamReader saveFile = new StreamReader("bananas.txt"); string line; Level currentReadLevel = null; string tempLine = ""; int px = 0, py = 0; string loadLevel = ""; while ((line = saveFile.ReadLine()) != null) { tempLine = line.Substring(2, line.Length - 2); string[] args = tempLine.Split('|'); //complete if (line[0] == 'L') { currentReadLevel = stringToLevel[tempLine]; } if (line[0] == 'I') { currentReadLevel.removeLevelItem(tempLine); } if (line[0] == 'P') { //Add player at location px = Int32.Parse(args[0]); py = Int32.Parse(args[1]); } if (line[0] == 'N') { int itemX = Int32.Parse(args[1]); int itemY = Int32.Parse(args[2]); switch (args[0]) { case "BatteryGooI": inventory.setInventoryItem(new BatteryGooI(), itemX, itemY); break; case "KnifeI": inventory.setInventoryItem(new KnifeI(), itemX, itemY); break; case "DiaryI": inventory.setInventoryItem(new DiaryI(), itemX, itemY); break; case "LampI": LampI lamp = new LampI(); if (args[3].Equals("T")) { lamp.setBatteries(true); } inventory.setInventoryItem(lamp, itemX, itemY); break; case "RopeI": inventory.setInventoryItem(new RopeI(), itemX, itemY); break; case "RoseI": inventory.setInventoryItem(new RoseI(), itemX, itemY); break; case "ScrollI": inventory.setInventoryItem(new ScrollI(args[3], args[4]), itemX, itemY); break; } } if (line[0] == 'S') { aboutScreen.addSeenObject(tempLine); } //complete if (line[0] == 'F') { bool platformComplete = (args[1].Equals("T")); findPlatformGivenString(args[0]).setItemOnPlatform(platformComplete); } if (line[0] == 'C') { loadLevel = tempLine; } } LevelTile lv = new LevelTile(0, 0, "blackBlock", "blackBlock", loadLevel, new Point(px, py)); saveFile.Close(); gameState = "play"; setLevel(lv); }
public override void makeInventoryItem() { inventoryItem = new LampI(); }