Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is a try at an Level editor for a TileBased 2D game. THe basis of it is that it takes values out of an array and places the texture on the rectangle that corresponds to that value. The code below is trying to make it so that i can change a single value of the array so that i can build stages by changing the value in the array, and that part works. The problem is that when i change the value, only the first row in the grid changes and all of the tiles in that row change instead of one. The code below might be complete crap but im am just a student of xna :) The first foorloop is to make sure i can accsess all the tiles and the second and third is to make sure i can pinpoint where i want the value to change in the array. Any suggestions to why this is happening would be very helpfull!
- for (int i = 0; i < TileId.Count; i++)
- {
- for (int y = 0; y < MapWidth; y++)
- {
- for (int x = 0; x < MapHeigth; x++)
- {
- if (TileId[i].Contains(mouse.X, mouse.Y) && mouse.LeftButton == ButtonState.Pressed)
- {
- MapGeneratorArray[x, y] = TileIdet;
- Map1.CollisionTiles.Clear();
- Map1.Generate(MapGeneratorArray, BlockSize);
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement