Monday, October 4, 2010

You can collect now

I was thinking of making it so the tiles are in another array but I don't want to clog stuff up!

Instead everytime you destroy a tile it runs this bit of code:


        public void CollectTile(int x, int y)
        {
            if (Level.tiles[x, y].Texture == Level.tiles[0, 0].Texture)
            {
                GlobalVaribles.Dirt++;
                GlobalVaribles.Cash += 1;
            }
            if (Level.tiles[x, y].Texture == Level.tiles[1, 0].Texture)
            {
                GlobalVaribles.Tin++;
                GlobalVaribles.Cash += 3;
            }
            if (Level.tiles[x, y].Texture == Level.tiles[2, 0].Texture)
            {
                GlobalVaribles.Gold++;
                GlobalVaribles.Cash += 5;
            }
            if (Level.tiles[x, y].Texture == Level.tiles[3, 0].Texture)
            {
                GlobalVaribles.Diamond++;
                GlobalVaribles.Cash += 10;
            }
            if (Level.tiles[x, y].Texture == Level.tiles[4, 0].Texture)
            {
                GlobalVaribles.Wood++;
            }
        }


What it does, Is compare the tile to 0,0 if it is the same on what's about to be destroyed run a code, if not then don't, i'm going to have to hide the tile's i'm using some how, maybe off screen but then my scrolling camera would pick it up.

Also in other news I made it so when you build it takes it from the ore you have so no replacing spots or anything, now I need an out of bounds check! I should add that in now :).


Impressive sexy particles!

No comments:

Post a Comment