コード例 #1
0
ファイル: Player.cs プロジェクト: deepakdamera/Platformer
    public virtual void Update(GameTime gameTime, List<Player> sprites)
    {

        
      Move();

      SetAnimations();

      _animationManager.Update(gameTime);
      
            // Removed for testing
      Position += Velocity;

            Xtrans = (int)Velocity.X;
            // Testing movement
            //Xtrans = (int)_position.X;
            _prevPos = Position;



            if (_position.X > graphics.PreferredBackBufferWidth/2)
            {
                _position.X= (float)(graphics.PreferredBackBufferWidth / 2);



            Velocity = Vector2.Zero;

       
    }
コード例 #2
0
        public virtual void Update(GameTime gameTime, List <Player> sprites)
        {
            Move();

            SetAnimations();

            _animationManager.Update(gameTime);

            Position += Velocity;

            Xtrans   = (int)Velocity.X;
            _prevPos = Position;


            if (_position.X > GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width / 2)
            {
                _position.X = (float)(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width / 2);
            }

            Velocity = Vector2.Zero;
        }
コード例 #3
0
ファイル: Enemy.cs プロジェクト: AdamPassanisi/Platformer
        public virtual void Update(GameTime gameTime, Player player, Dictionary <string, SoundEffect> soundEffects)
        {
            RandomMove(player, soundEffects);
            Position += Velocity;
            _animationManager.Update(gameTime);



            SetAnimations();



            Velocity = Vector2.Zero;
        }
コード例 #4
0
ファイル: Player.cs プロジェクト: AdamPassanisi/Platformer
        public virtual void Update(GameTime gameTime, List <Player> sprites, Dictionary <string, SoundEffect> soundEffects)
        {
            Move(soundEffects);

            SetAnimations();

            _animationManager.Update(gameTime);


            Position += Velocity;


            Xtrans         = Velocity.X;
            TotalDistance += Xtrans;
            _prevPos       = Position;



            if (_position.X > graphics.PreferredBackBufferWidth / 2)
            {
                Xtrans      = _position.X - graphics.PreferredBackBufferWidth / 2;
                _position.X = (float)(graphics.PreferredBackBufferWidth * 0.5);
                isHalfway   = true;
            }
            else if (_position.X < 0)
            {
                Xtrans      = 0;
                _position.X = 0;
            }
            else
            {
                isHalfway = false;
            }

            Velocity = Vector2.Zero;
        }