Esempio n. 1
0
 public void Follow(Player source)
 {
     this.source = source.getCenter();
 }
Esempio 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()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //Initalize the keyBoardStates
            current = previous = Keyboard.GetState();

            //initialize the player by Texture,position,width,height,speed
            redMan = new Player(Content.Load<Texture2D>("RedMan"), Content.Load<Texture2D>("Sprites/ShipSprite1"), new Vector2(50, 50),
                                new Rectangle(0,0,60,60), new Rectangle(0,0,32,32), 4.0f,0,Content,graphics.GraphicsDevice.Viewport);
            blueMan = new Player(Content.Load<Texture2D>("BlueMan"),Content.Load<Texture2D>("Sprites/ShipSprite2"), new Vector2(graphics.PreferredBackBufferWidth - 120, 50),
                                new Rectangle(0, 0, 60, 60), new Rectangle(0, 0, 32, 32), 4.0f, 1, Content, graphics.GraphicsDevice.Viewport);
            titleScreen = Content.Load<Texture2D>("Graphics/TitleScreenForGame");

            //Builds a map and lets the first test map go
            map = new MapReader(Content.Load<Texture2D>("XuCubeTiles"));
            map.init();
            map.buildMap("Content/Levels/level",0);

            players = new List<Player>();
            players.Add(redMan);
            players.Add(blueMan);

            //Building the camera
            cam = new Camera(graphics.GraphicsDevice.Viewport, Vector2.Zero);
            cam.Follow(redMan);

            //Creates the terminal
            debugTerminal = new Debugging(players, map, graphics.GraphicsDevice.Viewport);

            //initialize font
            font = Content.Load<SpriteFont>("SpriteFont1");
        }