Example #1
0
        private static float GetPlayerSpeed(Player player)
        {
            if (MappedInput.GetKey("Speed Modifier"))
            {
                player.IsRunning = false;
                return(player.WalkSpeed);
            }

            player.IsRunning = true;
            return(player.RunSpeed);
        }
Example #2
0
        private static Position GetInputAxis()
        {
            var pos = new Position();

            if (MappedInput.GetKey("Up"))
            {
                pos += new Position(0, 1);
            }
            if (MappedInput.GetKey("Down"))
            {
                pos += new Position(0, -1);
            }
            if (MappedInput.GetKey("Left"))
            {
                pos += new Position(-1, 0);
            }
            if (MappedInput.GetKey("Right"))
            {
                pos += new Position(1, 0);
            }
            return(pos);
        }