Beispiel #1
0
 public void Initialize(Animation animation, Vector2 position)
 {
     PlayerAnimation = animation;
        // PlayerTexture3 = texture;
     Position3 = position;
     Active = true;
     Health = 100;
 }
Beispiel #2
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            gameFont = content.Load<SpriteFont>(@"Graphics\gamefont");
            backgroundStart = content.Load<Texture2D>(@"Graphics\Backgrounds\gameplaystart");

            //initialize a new player. not sure why have to do it here.
            player = new Player();

               //use animation now.

            Animation playerAnimation = new Animation();
            Texture2D playerTexture = content.Load<Texture2D>(@"Graphics\shipAnimation");

            playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true);
            Vector2 playerPosition3 = new Vector2(ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.X, ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Y + ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
            player.Initialize(playerAnimation, playerPosition3);
            //----animation section ^

            // player.Initialize(content.Load<Texture2D>(@"Graphics\player"), playerPosition3);
            playerMoveSpeed = 8.0f;
            Thread.Sleep(1000);

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();
        }