5 Replies - 799 Views - Last Post: 19 April 2012 - 06:20 AM

#1 Themage  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-December 11

How to use a integer array with a list containing textures in XNA?

Posted 13 April 2012 - 12:33 PM

I have been learning C# over the pas few days and decided to jump into xna, I managed to load 4 textures into a list and create a array but how do I make the array use the list? Also should I have the list in the load method or is that a bad idea?
public int[,] map = new int[,] {
        {0, 1, 2, 3},
        {1, 2, 3, 0},
        {2, 3, 0, 1},
        {3, 0, 1, 2}
        };



List<Texture2D> Tile = new List<Texture2D>();
            Tile.Add(tile0);
            Tile.Add(tile1);
            Tile.Add(tile2);
            Tile.Add(tile3);
            tile0 = Content.Load<Texture2D>("tile0");
            tile1 = Content.Load<Texture2D>("tile1");
            tile2 = Content.Load<Texture2D>("tile2");
            tile3 = Content.Load<Texture2D>("tile3");



Is This A Good Question/Topic? 0
  • +

Replies To: How to use a integer array with a list containing textures in XNA?

#2 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: -4
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: How to use a integer array with a list containing textures in XNA?

Posted 13 April 2012 - 02:11 PM

This is something you'd be able to work out if you learn C# first. I strongly suggest you do that first!
Was This Post Helpful? 0
  • +
  • -

#3 Themage  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-December 11

Re: How to use a integer array with a list containing textures in XNA?

Posted 13 April 2012 - 02:50 PM

Yeah I should probably learn a little more first.
Was This Post Helpful? 0
  • +
  • -

#4 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: -4
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: How to use a integer array with a list containing textures in XNA?

Posted 13 April 2012 - 03:32 PM

You need to learn it thoroughly. :)
Was This Post Helpful? 0
  • +
  • -

#5 Quizton  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 49
  • Joined: 18-April 12

Re: How to use a integer array with a list containing textures in XNA?

Posted 18 April 2012 - 07:33 PM

View PostButchDean, on 13 April 2012 - 03:32 PM, said:

You need to learn it thoroughly. :)



or simply try this ;)

tileLayer.LoadTileTextures(
                Content,
                "Tiles/texture0",
                "Tiles/texture1",
                "Tiles/textur2");
       
        }

Was This Post Helpful? -1
  • +
  • -

#6 Kilorn  Icon User is offline

  • XNArchitect
  • member icon



Reputation: 1355
  • View blog
  • Posts: 3,528
  • Joined: 03-May 10

Re: How to use a integer array with a list containing textures in XNA?

Posted 19 April 2012 - 06:20 AM

I'm with here. You need a solid understanding of the fundamentals of not just the language you want to write games with, but also object oriented programming principles, design patterns, and effective time management skills to make sure you can make the time to work on these projects. Sure, you could learn game development from the ground up without any experience or pre-existing knowledge of programming, but it's like beating someone to death with a gun. There's a much more efficient way of handling things and following the right learning path will help you far more in the long run than just throwing shit together and seeing what works.
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1