Ejemplo n.º 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            level01 = Content.Load<Level>("Levels/Level_01");
            level01.Initialise(Content);
            player = new Player(this.Content, "XML Documents/DanAnimations", level01);
            goblin = new Enemy(this.Content, "XML Documents/GoblinAnimations", level01);
            goblin1 = new Enemy(this.Content, "XML Documents/GoblinAnimations", level01);
            goblin2 = new Enemy(this.Content, "XML Documents/GoblinAnimations", level01);
            player.Position = new Vector2(0.0f, 420.0f);

            goblin.Position = new Vector2(500.0f, 420.0f);
            goblin1.Position = new Vector2(1000.0f, 420.0f);
            goblin2.Position = new Vector2(200.0f, 420.0f);
            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            GV.ContentManager = Content;
            TDManager.Initialize();
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            // Old loading method
            level = Content.Load<Level>("Levels/Level_01");
            // New loading method
            //level = Level.Load("../../../../Kismet Content/Levels/Level01_A.xml");
            level.Initialise(Content);

            GV.Level = level;
            GV.SpriteBatch = spriteBatch;

            GV.LEFT = "left";
            GV.RIGHT = "right";
            GV.GRAVITY = 1.0f;
            GV.ShowBoxes = true;

            player = new Player("XML Documents/DanAnimations", GV.Level.PlayerStartingPosition);

            GV.Player = player;

            Camera.WorldRectangle = new Rectangle(0, 0, GV.Level.Width, GV.Level.Height);
            Camera.Position = new Vector2(0, 0);
            Camera.ViewPortWidth = 1280;
            Camera.ViewPortHeight = 720;

            GV.EDITING = false;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;

            //graphics.GraphicsDevice.SetRenderTarget(new RenderTarget2D(graphics.GraphicsDevice, 1280, 720));

            //ResourceManager.Instance.Texture("Tiles", Content.Load<Texture2D>(System.IO.Path.Combine(@"Tiles\", "Tiles")));
            GV.ContentManager = Content;
            TDManager.Initialize();
            //level01 = Level.Load("../../../../Level EditorContent/Levels/Level01_A.xml");
            level01 = Content.Load<Level>("Levels/Level_01");
            level01.Initialise(Content);

            GV.Level = level01;
            GV.SpriteBatch = spriteBatch;

            GV.LEFT = "left";
            GV.RIGHT = "right";
            GV.GRAVITY = 1.0f;
            GV.ShowBoxes = true;

            player1 = new Player("XML Documents/DanAnimations", level01.PlayerStartingPosition);

            GV.Player = player1;

            // Setup the camera
            Camera.WorldRectangle = new Rectangle(0, 0, GV.Level.Width, GV.Level.Height);
            Camera.Position = new Vector2(0, 0);
            Camera.ViewPortWidth = pictureBox.Width;
            Camera.ViewPortHeight = pictureBox.Height;

            lastMouseState = Mouse.GetState();
            pictureBox_SizeChanged(null, null);

            GV.EDITING = true;
            followPlayer = false;
        }
Ejemplo n.º 4
0
 private static void SaveToDocumentFormat(Level serializableObject,
         System.Type[] extraTypes, string path,
         IsolatedStorageFile isolatedStorageFolder)
 {
     using (TextWriter textWriter =
            CreateTextWriter(isolatedStorageFolder, path))
     {
         XmlSerializer xmlSerializer = CreateXmlSerializer(extraTypes);
         xmlSerializer.Serialize(textWriter, serializableObject);
     }
 }
Ejemplo n.º 5
0
 private static void SaveToBinaryFormat(Level serializableObject,
         string path, IsolatedStorageFile isolatedStorageFolder)
 {
     using (FileStream fileStream =
            CreateFileStream(isolatedStorageFolder, path))
     {
         BinaryFormatter binaryFormatter = new BinaryFormatter();
         binaryFormatter.Serialize(fileStream, serializableObject);
     }
 }
Ejemplo n.º 6
0
        public object Clone()
        {
            Level level = new Level();

            level.AssetName = AssetName;
            level.Width = Width;
            level.Height = Height;
            level.GroundLayerTexture = GroundLayerTexture;
            level.groundLayer = groundLayer;

            return level;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initialises the singleton's values
 /// </summary>
 /// <param name="currentPlayer">The player object</param>
 /// <param name="currentLevel">The level currently being used</param>
 public void Initialise(Player currentPlayer, Level currentLevel)
 {
     textures = new Dictionary<string, Texture2D>();
     levels = new Dictionary<string, Level>();
     player = currentPlayer;
     level = currentLevel;
 }