示例#1
0
        public Hinged(ContentManager content, Vector2 location, Player player)
            : base(content)
        {
            frameWidth = 40;
            frameHeight = 40;
            var texture = content.Load<Texture2D>(@"Textures\Sprites\ShipEnemies\Hinged");
            animations.Add("idle",
                           new AnimationStrip(
                               texture,
                               frameWidth, frameHeight, 0, 1, "idle"));
            animations["idle"].LoopAnimation = false;
            animations["idle"].FrameLength = 0f;

            animations.Add("open",
                           new AnimationStrip(
                               texture,
                               frameWidth, frameHeight, 0, 4, "open"));
            animations["open"].LoopAnimation = false;
            animations["open"].FrameLength = 0.2f;

            animations.Add("die",
                           new AnimationStrip(
                               texture,
                               frameWidth, frameHeight, 0, 1, 5, "die"));
            animations["die"].LoopAnimation = false;
            animations["die"].FrameLength = 0f;

            CollisionRectangle = new Rectangle(0,0,40,40);

            ignoresMapScroll = false;
            worldLocation = location;
            moveSpeed = 0f;
            velocity = Vector2.Zero;
            clampToScreen = false;
            clampToWorld = false;
            enabled = true;
            PlayAnimation("idle");

            this.player = player;
            shotManager = new ShotManager(content.Load<Texture2D>(@"Textures\Sprites\Weapons\BasicRed"), 7, 475f, 0f);
        }
示例#2
0
        /// <summary>
        /// Initializes all players
        /// </summary>
        private void initializePlayers()
        {
            //Initialize first player now that the texture is loaded. The position is manually set to the Tile with Tile ID -1, Although
            //this needs to be revised to place it at a specified home base.

            player1 = new Player(Tile.player1Home,
                new Vector2(Tile.cellBorder.Width, Tile.cellBorder.Height),
                new Cursor(cursorTexp1, 1), PlayerIndex.One);
            playerList.Add(player1);

            player2 = new Player(Tile.player2Home,
                new Vector2(Tile.cellBorder.Width * 10, Tile.cellBorder.Height),
                new Cursor(cursorTexp2, 1), PlayerIndex.Two);
            playerList.Add(player2);

            player3 = new Player(Tile.player3Home,
                new Vector2(Tile.cellBorder.Width, Tile.cellBorder.Height * 7),
                new Cursor(cursorTexp3, 1), PlayerIndex.Three);
            playerList.Add(player3);

            player4 = new Player(Tile.player4Home,
                new Vector2(Tile.cellBorder.Width * 10, Tile.cellBorder.Height * 7),
                new Cursor(cursorTexp4, 1), PlayerIndex.Four);
            playerList.Add(player4);

            foreach (Player p in playerList)
                p.LoadContent(this.Content, this.graphics);
        }