Example #1
0
        private void Movimiento(MotorColisiones Colisionador)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Up))
                if (!Colisionador.ChocaPared(new Vector2(posicionLog.X, posicionLog.Y - VelMov)))
                    posicionLog.Y -= VelMov;
            if (Keyboard.GetState().IsKeyDown(Keys.Right))
                if (!Colisionador.ChocaPared(new Vector2(posicionLog.X + VelMov, posicionLog.Y)))
                    posicionLog.X += VelMov;
            if (Keyboard.GetState().IsKeyDown(Keys.Down))
                if (!Colisionador.ChocaPared(new Vector2(posicionLog.X, posicionLog.Y + VelMov)))
                    posicionLog.Y += VelMov;
            if (Keyboard.GetState().IsKeyDown(Keys.Left))
                if (!Colisionador.ChocaPared(new Vector2(posicionLog.X - VelMov, posicionLog.Y)))
                    posicionLog.X -= VelMov;

            if (posicionLog.Y < 0)
                posicionLog.Y = 0;
        }