Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7179989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:15:14+00:00 2026-05-28T17:15:14+00:00

Im making a silly 2D game but is struggling a bit with external files

  • 0

Im making a silly 2D game but is struggling a bit with external files that describes how the map should look like.

I currently have map001.txt that looks like this

00000000000000000000
01111111111111111110
01111111111111111110
01111111111111111110
01111111111111111110
01111111111111111110
01111111111111111110
00000000000000000000
00000000000000000000
00000000000000000000

Using TextReader does not make it happen, it cant seem to find the file 🙁

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:15:15+00:00Added an answer on May 28, 2026 at 5:15 pm

    Windows Phone 7 uses Isolated Storage, which is different approach than other systems e.g. Windows 7.

    I assume you are using C# and you have maps predefined. You have two options

    • Include file in the project
    • write this map string into the code

    there are more option – like using database – but these two are simple and good enough. If I were you I would go with second one. Map looks pretty simple, so the loading time and memory using shouldn’t be a problem.

    Best way is to define a helper (if you are interested why I made it static readonly here’s an explanation)

    public static class MapHelper
    {
        public static readonly string Map = @"
                                              00000000000000000000
                                              01111111111111111110
                                              01111111111111111110
                                              01111111111111111110
                                              01111111111111111110
                                              01111111111111111110
                                              01111111111111111110
                                              00000000000000000000
                                              00000000000000000000
                                              00000000000000000000
                                              ";
    
    }
    

    Now if you want to extract the map as lines here a snippet

      var lines = Map.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
    

    to get the width and height use

            width = lines.Select(x => x.Length).Max();
            height = lines.Length;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I feel like this is a silly question but I always find that modifying
I have a silly little game that I made just for myself, but I
I am sure making a silly mistake but I can't figure what: In SQL
its kind of silly question. but i dont know what mistake i am making.
I'm sure I'm making some kind of silly mistake here, but when converting a
I am doing something that is probably silly, but it would be nice if
I'm struggling with grabbing an image at the moment... sounds silly, but check out
I am probably making some silly mistake but I am newer to the world
I know it may sound silly, but i worked for a client that seems
I'm french so sorry for my english. I'm currently making a splitscreen 2D game

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.