fork download
  1. using System.Collections.Generic;
  2. using Microsoft.Xna.Framework;
  3. using Microsoft.Xna.Framework.Graphics;
  4. using Microsoft.Xna.Framework.Input;
  5. using Sandbox.Map;
  6. using Sandbox.Tiles;
  7.  
  8. namespace Sandbox
  9. {
  10. public class Game1 : Game
  11. {
  12. GraphicsDeviceManager graphics;
  13. SpriteBatch spriteBatch;
  14.  
  15. Texture2D spriteFloor;
  16. Texture2D spriteWall;
  17.  
  18. GameMap FirstMap = new GameMap(20, 11);
  19.  
  20. List<Title> titles;
  21. public Game1()
  22. {
  23. graphics = new GraphicsDeviceManager(this);
  24. Content.RootDirectory = "Content";
  25. }
  26.  
  27.  
  28. protected override void Initialize()
  29. {
  30. FirstMap.setMap();
  31. setGameMap();
  32. base.Initialize();
  33. }
  34.  
  35.  
  36. protected override void LoadContent()
  37. {
  38. spriteBatch = new SpriteBatch(GraphicsDevice);
  39.  
  40. spriteFloor = Content.Load<Texture2D>("floor");
  41. spriteWall = Content.Load<Texture2D>("wall");
  42. }
  43.  
  44. protected override void UnloadContent()
  45. {
  46. // TODO: Unload any non ContentManager content here
  47. }
  48.  
  49. public void setGameMap()
  50. {
  51. titles = new List<Title>();
  52.  
  53. int X = 0;
  54. int Y = 0;
  55. for (int i = 0; i < FirstMap.width; i++)
  56. {
  57. for (int j = 0; j < FirstMap.length; j++)
  58. {
  59. if (FirstMap.map[i, j] == 1)
  60. {
  61. Title aWall = new Wall(spriteWall);
  62.  
  63. aWall.Position.X = X;
  64. aWall.Position.Y = Y;
  65.  
  66. titles.Add(aWall);
  67. }
  68. else if (FirstMap.map[i, j] == 0)
  69. {
  70. Title aFloor = new Floor(spriteFloor);
  71.  
  72. aFloor.Position.X = X;
  73. aFloor.Position.Y = Y;
  74.  
  75. titles.Add(aFloor);
  76. }
  77. X += 30;
  78. }
  79. X = 0;
  80. Y += 30;
  81. }
  82. }
  83. protected override void Update(GameTime gameTime)
  84. {
  85. if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
  86. Exit();
  87.  
  88. // TODO: Add your update logic here
  89.  
  90. base.Update(gameTime);
  91. }
  92.  
  93. protected override void Draw(GameTime gameTime)
  94. {
  95. GraphicsDevice.Clear(Color.CornflowerBlue);
  96. spriteBatch.Begin();
  97.  
  98. foreach (Title element in titles)
  99. {
  100. element.draw(spriteBatch);
  101. }
  102.  
  103. spriteBatch.End();
  104. base.Draw(gameTime);
  105. }
  106. }
  107. }
  108.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(2,17): error CS0234: The type or namespace name `Xna' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
prog.cs(3,17): error CS0234: The type or namespace name `Xna' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
prog.cs(4,17): error CS0234: The type or namespace name `Xna' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
prog.cs(5,15): error CS0234: The type or namespace name `Map' does not exist in the namespace `Sandbox'. Are you missing an assembly reference?
prog.cs(6,15): error CS0234: The type or namespace name `Tiles' does not exist in the namespace `Sandbox'. Are you missing an assembly reference?
prog.cs(10,26): error CS0246: The type or namespace name `Game' could not be found. Are you missing an assembly reference?
prog.cs(12,9): error CS0246: The type or namespace name `GraphicsDeviceManager' could not be found. Are you missing an assembly reference?
prog.cs(13,9): error CS0246: The type or namespace name `SpriteBatch' could not be found. Are you missing an assembly reference?
prog.cs(15,9): error CS0246: The type or namespace name `Texture2D' could not be found. Are you missing an assembly reference?
prog.cs(16,9): error CS0246: The type or namespace name `Texture2D' could not be found. Are you missing an assembly reference?
prog.cs(18,9): error CS0246: The type or namespace name `GameMap' could not be found. Are you missing an assembly reference?
prog.cs(20,14): error CS0246: The type or namespace name `Title' could not be found. Are you missing an assembly reference?
prog.cs(28,33): error CS0115: `Sandbox.Game1.Initialize()' is marked as an override but no suitable method found to override
prog.cs(36,33): error CS0115: `Sandbox.Game1.LoadContent()' is marked as an override but no suitable method found to override
prog.cs(44,33): error CS0115: `Sandbox.Game1.UnloadContent()' is marked as an override but no suitable method found to override
prog.cs(83,40): error CS0246: The type or namespace name `GameTime' could not be found. Are you missing an assembly reference?
prog.cs(93,38): error CS0246: The type or namespace name `GameTime' could not be found. Are you missing an assembly reference?
Compilation failed: 17 error(s), 0 warnings
stdout
Standard output is empty