When your back, hips, and other joints hurt, it’s tempting to crawl into bed with a heating pad and avoid doing anything. Yet staying active is important if you want to keep your joints and muscles flexible.

Getting out of the house will also help prevent feelings of loneliness and isolation that you may be experiencing.

Here’s a list of seven fun things to try if you’re living with ankylosing spondylitis (AS). These activities will not only take your mind off your pain, but they may also help to control it.

Walking should already be part of your daily routine. It helps loosen tight joints and is low impact enough to prevent you from putting too much strain on them.

Start by walking for 5 or 10 minutes, and gradually increase the amount of time as you feel up to it. Weather permitting, go for a walk outdoors. The fresh air, sunshine, and exposure to plants and trees will give your mood a boost too.

Bring a friend — human or canine — along to keep you company.

Swimming is one of the best exercises you can do when you have arthritis. The water offers resistance that helps strengthen your muscles, yet it’s buoyant and gentle on your joints. Research finds water exercise helps improve pain and quality of life in people with ankylosing spondylitis.

Snorkeling is an especially good water activity for people with this condition. Lifting and turning your head to breathe can be hard on the joints in your neck. The snorkel and mask let you keep your head down in the water and relax your neck.

Plus, the mask will give you a window into the colorful aquatic life in your local lake or ocean.

Yoga combines exercise and meditation in one program that’s good for both your body and mind. The movements improve flexibility, strength, and balance, while the deep breathing helps reduce stress and anxiety.

If you’ve never practiced before, find a beginner or gentle yoga class — or one that’s designed for people with arthritis. Always work within your comfort level. If a pose hurts, stop.

Tai chi is another ideal exercise program for people with arthritis. This ancient Chinese practice also combines elements of physical exercise with relaxation techniques. It can help improve balance, flexibility, and aerobic endurance, while still being low impact and safe on your joints.

Research from 2007 finds that regular tai chi practice improves flexibility and reduces disease activity in people with ankylosing spondylitis.

Feel too sore to go out to a restaurant or party? Host a meal for friends at your house. Having friends over for dinner lets you control the menu.

Incorporate lots of green leafy vegetables, fruits, fish (for the omega-3 fatty acids), cheese (for the calcium), and whole grains like wheat bread and brown rice into your meal. To make things fun, and easier for you, let your guests help out with the cooking.

A spa trip is a great way to relax you. Treat yourself to a massage, which can help loosen up stiff joints. Although the research on massage for AS is limited, some studies suggest it can help with back, neck, and shoulder pain, as well as stiffness and fatigue.

Make sure that your massage therapist has worked with people who have arthritis and is careful to not put too much pressure on your bones and joints.

While you’re at the spa, take a dip in the hot tub. The heat will feel soothing on your sore joints.

Dancing is one of the best exercises for AS — provided you keep it low impact. It can improve your flexibility and balance while burning calories. Try a Zumba class at your gym, or take a ballroom dance class with your partner at your local school or community center.

Most people with AS say their joints are like a barometer. They know when the weather is turning cold or humid by the achiness they feel. If this is you, and you live in a cold, wet climate, you could benefit from some time spent in a warmer location.

Book a trip out West. States like Arizona, Nevada, and California can be more accommodating to sore joints.