1 hour ago, Shawn Naef said:Ok the list is edited. The draw code is edited. I am still encountering errors (35 Total)
About 5 of these errors.
Error 1 'System.Collections.Generic.List<System.Collections.Generic.List<intes not contain a definition for 'GetLength' and no extension method 'GetLength' accepting a first argument of type 'System.Collections.Generic.List<System.Collections.Generic.List<intuld be found (are you missing a using directive or an assembly reference?) C:\Users\Haswell\documents\visual studio 2010\Projects\Vertical Miner Infinity\Vertical Miner Infinity\Vertical Miner Infinity\Game1.cs 424 44 Vertical Miner Infinity
About 30 errors stemming from this
I also need to know how to edit the list from my code: (Example of one of the sections) Error is ((tileMap[PlayerDepth, CheckSpot] == 9)
Specifically tileMap is now a list not an array.
else if ((tileMap[PlayerDepth, CheckSpot] == 9) && (GoAgain) && (PlayerFuel > 0)) { // Its just air so moving is fine. cameraPositionX = cameraPositionX - 64; PlayerPosition--; PlayerFuel--; GoAgain = false; TotalMovesMade++; TotalFuelUsed++; }
The errors are telling you exactly what is wrong.
"
Error 1 'System.Collections.Generic.List<System.Collections.Generic.List<intes not contain a definition for 'GetLength' and no extension method 'GetLength' accepting a first argument of type 'System.Collections.Generic.List<System.Collections.Generic.List<intuld be found (are you missing a using directive or an assembly reference?) C:\Users\Haswell\documents\visual studio 2010\Projects\Vertical Miner Infinity\Vertical Miner Infinity\Vertical Miner Infinity\Game1.cs 424 44 Vertical Miner Infinity
"
The first error is telling you that List does not contain .GetLength which is true. When dealing with List you would use .Count to find out how many entries exist. Since columns can have a number of rows you'll have keep this in mind when doing for loops. When using any class in C# that you're unaware of, look online for the reference so you can see all the methods: https://msdn.microsoft.com/en-us/library/6sh2ey19(v=vs.110).aspx You'll find that Count does: Gets the number of elements contained in the List<T>. You'll also find that First() does: Returns the first element of a sequence. (The same as doing myMap[0].Count)
In general to see your columns and rows you would just use this: myMap.Count and myMap.First().Count assuming your rows are the same amount per column.
To answer your question about:
"
I also need to know how to edit the list from my code: (Example of one of the sections) Error is ((tileMap[PlayerDepth, CheckSpot] == 9)
"
The error is correct because you don't use [,] for List you use [][] (Since it's a List of List). So use tileMap[PlayerDepth][CheckSpot] == 9
If you're looking to change values at index just use tileMap[y][x] = VALUE; If you're looking at expanding more, just use .Add(new List<int> { 0, 0, 0, 0, 0 }); If you're expanding to the right, you'll have to loop through each myMap[a] and .Add()
To keep things simple make sure your rows are equal per column, and put a variable to indicate empty such as 0.