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

  • SEARCH
  • Home
  • 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 6149453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:27:12+00:00 2026-05-23T19:27:12+00:00

I need help with my map editor, I’m stuck on saving it. When I

  • 0

I need help with my map editor, I’m stuck on saving it. When I save, after I put some grass on map, it gets grass everywhere in map file.
Here’s variables:

mapMaximumX: maximum of the map in X (it is set as 500)

mapMaximumY: maximum of the map in Y (it is also set as 500)

mapTiles[index]: this is a list with class, each class has ID (0 = empty, 1 = grass, 2 = water), X and Y

        if (Keyboard.GetState().IsKeyDown(Keys.F1))
        {
            for(int y = 0; y < mapMaximumY; y++) 
            {
                for (int x = 0; x < mapMaximumX; x++)
                {

                    if (MapTiles[i3].X == x && MapTiles[i3].Y == y)
                    {

                    }

                    else
                    {
                        MapTiles.Add(new Class1(0, x * 32, y * 32));
                    }

                    if (i3 < MapTiles.Count)
                    {
                        i3++;
                    }
                }
            }

            TextWriter file = new StreamWriter("map1.MAP");
            for (int y = 0; y < mapMaximumY; y++)
            {
                for (int x = 0; x < mapMaximumX; x++)
                {
                    file.Write(MapTiles[i2].ID + ", ");
                }
                file.Write(file.NewLine);
            }
            i2 = 0;
            System.Windows.Forms.MessageBox.Show("Saved!");
            file.Close();
        }

Full code is here, if u need it:

http://pastebin.com/qrWbuPtb

Thanx.

  • 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-23T19:27:13+00:00Added an answer on May 23, 2026 at 7:27 pm
    file.Write(MapTiles[i2].ID + ", ");
    

    i2 never changes within your loop, so whatever i2 is will always be what’s used to write your output.

    You need to be using X and Y from your loops in determining which cell to write out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help,showing a map inside my rails 3.0 pages I fond cartographer
I need help with this route map routes.MapRoute(Blog_Archive, Blog/Archive/{year}/{month}/{day}, new { controller = Blog,
I need help understanding some C++ operator overload statements. The class is declared like
I need some help understanding how stdext::hash_multimap's lower_bound, upper_bound and equal_range work (at least
I'm not much of a database guru so I need some help on a
I really don't know how to title this question, but I need some help
I need help from some one to convert the following line of code from
I made this function and need some help sorting out the logic flow. It
I have a newbie question. I need help on separating a text file into
I am working on a small roguelike game, and need some help with creating

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.