Before we work on getting those Floaters to work, first we are going to set up the lava collections.

So, you may know the procedure by now.
First we declare the ArrayList of Lava in the declarations.

		ArrayList lavas;
		/* This holds all of the lava pools that are in this level */
Then, we initialize the lava arraylist in the Load procedure. So, we replace the lava instantiation:
			lava = Rectangle.FromLTRB(380, 520, 420, thelandheight);
			// Positions a lava on the display at these coordinates.
With the instantiation for the lavas arraylist.
			lavas = new ArrayList(20);
			//Create the arraylist.
			lavas.Add(Rectangle.FromLTRB(380, 520, 420, thelandheight));
			// Positions a lava on the display at these coordinates.
Now, we draw the lavas that are located in the arraylist. So the portion of code that draws the lava in the Artwork subroutine can be replaced with:
			foreach (Rectangle lava in lavas) 
			{
				gfx.FillRectangle(lavabrsh, lava);
				gfx.DrawRectangle(Pens.DarkOrange, lava);
				// Draw the lava to the form.
			}
Then, we allow the player to interact with the lava, by putting in the CharacterMovement subroutine another For Each Loop.
				foreach (Rectangle lava in lavas) 
				{
					if (playerloc.IntersectsWith(lava)) 
					{
						// Touched the lava, now you must die.
						isgoner = true;

						playerveloc = PFMain.thesbarinitialvelocity;
						// This is for a falling animation when the player is beaten.
					}
				}
One gets used to that after a while of development. Now, let's add support for lava in our edit mode. In my level, there's not really a good spot for placing lava since I have coins everywhere, but I'll try to find one. Fortunately, for adding editor support, all we need to do is add another character (and of course getting it to save to / load from file). So, set TESTversion if it is unset, and head onto the KeyDown event (remember, that's where we determine which key the user has pressed). Let's pick a character to denote lava. Hmmm, tough choice. How about 'L'? So, let's make L set us into lava placement mode.
			else if (e.KeyCode == Keys.L) 
			{
				if (!ismousedown)
				{
					modobject = 'L';
				}
			}
Now, the object is finalized in the MouseUp routine (and the MouseUp routine only runs when TESTversion is set to 1).
				case 'L':
					placed = Rectangle.FromLTRB(Math.Min(initialpt.X, finalpt.X), Math.Min(initialpt.Y, finalpt.Y), Math.Max(initialpt.X, finalpt.X), Math.Max(initialpt.Y, finalpt.Y));
					lavas.Insert(0, placed);
					// Add the lava to the level.
					break;
And now, you can add more than one patch of lava on the form. Now, support has to be added to save these patches of lava to the file. So, in the savelevel subroutine, we save the number of lavas and then save the LTRB of each lava as usual.
			bw.Write(lavas.Count);
			// Next, write lavas to the file.
			foreach (Rectangle lava in lavas) 
			{
				bw.Write(lava.Left);
				bw.Write(lava.Top);
				bw.Write(lava.Right);
				bw.Write(lava.Bottom);
				// Write lava LTRB to binary file.
			}
And now, you can go in and edit the lava as you wish.
Now, when you are finished, remove the lava initialization code in the Load event.
			lavas = new ArrayList(20);
			//Create the arraylist.

			lavas.Add(Rectangle.FromLTRB(380, 520, 420, thelandheight));
			// Positions a lava on the display at these coordinates.
Next, we need to add support for loading the lava back into the level, so let's go to the loadlevel subroutine. Also, realize that we have to load the lavas in the same place that we saved them. So, if the lavas were saved after the coins, we need to load them after the coins.
			lavas = new ArrayList(br.ReadInt32());
			// Number of lava pools.
			for (lv = 0; lv < lavas.Capacity; lv++) 
			{
				lavas.Add(Rectangle.FromLTRB(br.ReadInt32(), br.ReadInt32(), br.ReadInt32(), br.ReadInt32()));
				// Create rectangle that forms the lava pool.
			}
And there you have lavas loaded from file.
Now, an editor wouldn't be complete if you couldn't specify the file that you wanted to save to. Let's create a Save File Dialog so that we can save multiple files. First, we set the Save File Dialog properties. Then, we put all of the code that we have for saving the level inside of the if block. You can see the if statement below that indicates if the user has agreed on a file by clicking OK. Don't forget the final closing brace.
			SaveFileDialog sfd = new SaveFileDialog();
			sfd.Filter = "Level Files|*.lvl";
			sfd.InitialDirectory = Application.StartupPath;
			sfd.OverwritePrompt = true;
			sfd.Title = "Select the location where this level will be saved.";
			if (sfd.ShowDialog() == DialogResult.OK) 
			{
				System.IO.FileStream fs = new System.IO.FileStream(sfd.FileName , System.IO.FileMode.Create);
				System.IO.BinaryWriter bw = new System.IO.BinaryWriter(fs);
Now, you can save the file to a different filename.
Next, let's allow different files to be read. We will add a parameter to loadlevel that specifies which file to read for this level. So, now our declaration for loadlevel looks like this.
		private void loadlevel(string filename) 
And now, from the form's Load procedure, we have to call it like this:
			loadlevel(Application.StartupPath + @"\data.lvl");
			// Load the level information from the file.
When we start the game, we'll eventually have a level variable which will be used to generate a filename. Next, we'll actually go over those floaters (hopefully).