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 7774585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:24:58+00:00 2026-06-01T17:24:58+00:00

I have a XNA programm which draws a field (50×50) of a texture The

  • 0

I have a XNA programm which draws a field (50×50) of a texture

enter image description here

The code of the drawing looks like that:

namespace Village
{
    public class DrawLogic
    {

        internal static void DrawCreatures(GameTime gameTime, GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, Dictionary<string, Texture2D> creatureTextures, List<Creature> list, Coordinate current)
        {
            spriteBatch.Begin();
            foreach (var item in list)
            {
                Vector2 origin = new Vector2(0, 0);
                if (item.Selected)
                {
                    spriteBatch.Draw(creatureTextures["selected"], new Vector2((item.Coordinates.X * 32) - current.X, (item.Coordinates.Y * 32) - current.Y), new Rectangle(0, 0, creatureTextures["human"].Width, creatureTextures["human"].Height), Color.White, 0.0f, origin, 1f, SpriteEffects.None, 1f);
                }
                else
                {
                    spriteBatch.Draw(creatureTextures["human"], new Vector2((item.Coordinates.X * 32) - current.X, (item.Coordinates.Y * 32) - current.Y), new Rectangle(0, 0, creatureTextures["human"].Width, creatureTextures["human"].Height), Color.White, 0.0f, origin, 1f, SpriteEffects.None, 1f);
                }
            }
            spriteBatch.End();
        }

        internal static void DrawObjects(GameTime gameTime, GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, Dictionary<string, Texture2D> creatureTextures, List<IHarvestable> list, Coordinate current)
        {
            spriteBatch.Begin();
            foreach (var item in list)
            {
                Vector2 origin = new Vector2(0, 0);

                spriteBatch.Draw(creatureTextures["tree"], new Vector2((item.Coordinates.X * 32) - current.X, (item.Coordinates.Y * 32) - current.Y), new Rectangle(0, 0, creatureTextures["tree"].Width, creatureTextures["tree"].Height), Color.White, 0.0f, origin, 1f, SpriteEffects.None, 1f);

            }
            spriteBatch.End();
        }

        internal static void DrawMap(GameTime gameTime, GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, Dictionary<string, Texture2D> worldTextures, Block[,] map, Coordinate current)
        {
            spriteBatch.Begin();

            for (int i = 0; i < map.GetLength(0); i++)
            {
                for (int j = 0; j < map.GetLength(1); j++)
                {
                    if (map[i, j].GetType() == typeof(Grass))
                    {


                        Vector2 origin = new Vector2(0, 0);
                        spriteBatch.Draw(worldTextures["grass"], new Vector2((i * 32) - current.X, (j * 32) - current.Y), new Rectangle(0, 0, worldTextures["grass"].Width, worldTextures["grass"].Height), Color.White, 0.0f, origin, 1.0f, SpriteEffects.None, 1f);
                    }
                }
            }

            spriteBatch.End();
        }
    }
}

My Question ist now, how can i rotate the whole map?

It should look like that:

The first shape is how i looks now, and the second one is how it should look

I don’t know whats the best way to do this.

Should I rotate everyone of my textures and put them in the right order, or is there a way to rotate the whole level?

I think if I could rotate the whole level, the walking algorithm of my creatures would me much easier, because it wouldn’t be different then my current algorithm.

The other way (rotating every single texture) would be much harder.. I think.

Thanks in advance!

  • 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-06-01T17:24:59+00:00Added an answer on June 1, 2026 at 5:24 pm

    The way I would do it is to apply a rotation matrix to the projection matrix before you draw the map. You can see a small how-to in the XNA documentation here.

    If you’re looking for an isometric projection (which I think is what you’re actually looking for), the tile engine tutorial on XNA Resources goes into it here.

    I’m not sure I see how that would simplify your “walking algorithm,” though, as rotating the display in this regard is for visual purposes only and has no impact on the data behind the scenes. Could you go into further detail in why you think it would change things?

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

Sidebar

Related Questions

I have an XNA 4.0 project that I would like to be compiled with
I have an XNA 3.1 program and would like to create an installer that
I have an XNA arcade game which runs over Silverlight environment. The game has
I have a WP7 XNA game that needs to save the state whenever the
I have a problem with the logic of this code, XNA's Update Method is
The following code is a complete XNA 3.1 program almost unaltered to that code
I'm following an XNA tutorial and have the following code for collision detecting (detecting
I have just started learning XNA. This is my first program that I am
I have a winforms application which uses xna to act as a 2d editor
i have a simple xna game that i want to port that to silverlight,

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.