예제 #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);
            Animation playerAnimation = new Animation();
            playerAnimation.Initialize(Content.Load<Texture2D>("walk"), Vector2.Zero, 60, 100, 6, 30, Color.White, 1f,true);
            //Позиция игрока
            Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
            //Загружаем игрока
            player.Initialize(Content.Load<Texture2D>("base"),Content.Load<Texture2D>("punch"),playerAnimation,playerPosition);

            target = Content.Load<Texture2D>("target");

            List<Texture2D> textures = new List<Texture2D>();
            textures.Add(Content.Load<Texture2D>("blood"));
            blood = new Blood(textures, new Vector2(430, 350));
        }
예제 #2
0
        //Инициализация игрока
        public void Initialize(Texture2D texture,Texture2D punch,Animation animation, Vector2 position)
        {
            //Получаем текстуру
            PlayerTexture = texture;
            PunchTexture = punch;

            PlayerAnimationMove = animation;

            //Устанавливаем скорость перемещения
            playerMoveSpeed = 3.0f;

            //Получаем позицию
            Position = position;
            //Активируем игрока
            Active = true;
            //Полное здоровье
            Health = 100;

            //вначале смотрит в право
            isLeft = false;
        }