Barcelona is a walkable city. It has a ton of pedestrian-friendly boulevards. When planning your trip, consider clubbing attractions together that are in the same neighborhood, like La Ramblas, Gothic Quarter, and Port Vell (with beach time).  You do need to wear comfortable walking shoes to enjoy the lanes of Barcelona.  Other than these areas, many attractions like the Sagrada Familia, Casa Battlo, Camp Nou, Barcelona Cathedral, etc are very far away from each other. So you will need public transportation to access them. Or book tours to explore the same.