![]() |
|
[.NET] Check string in text document and set correct texture accordingly XNA - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Check string in text document and set correct texture accordingly XNA (/showthread.php?tid=5573788) |
Check string in text document and set correct texture accordingly XNA - Hogtalare1 - Mar 13, 2017 We're currently working on a school project where we are going to make a very simple little game, but here is my problem: I currently have a text document in which I write coordinates where I want to place a certain sprite using "streamreader" formatted like this: CoordinateX:CoordinateY:texturename. I have made another classfile called "level" with methods with get and set functions for each value. Code while ((k = blockposition.ReadLine()) != null)Here it adds the strings and floats from the text document into the list "List<level> tilesposlist = new List<level>();". Code for (int i = 0; i < tilesposlist.Count; i++)Now I want the program to check the "tilestexturess" in the text document and change the "tiles" texture to the correct texture from all the textures I have. I was thinking of having another list where I put all textures and then make it check if the names match. How do I do this in the most simplest form? Sorry guys just realized I posted in wrong section. If admin sees this. Please close/remove :) * - Hogtalare1 - Mar 14, 2017 (Mar 13, 2017 06:03 AM)Orka Wrote: Is there an opportunity to save an incorrect texture name? All I can think is checking the texture file exists which does not require a collection.What would be the easiest way to make the program check if the texture file exist? Do I need to put all textures into a list? * - stratex - Mar 14, 2017 It looks like you have the tiletemppos.X taking the Y value and vice versa for the other. |