Pseudomonas aeruginosa often colonises immunocompromised patients and the lungs of cystic fibrosis patients. It exhibits resistance to many antibiotics by forming biofilms, which makes it hard to eliminate. P. aeruginosa biofilms form mushroom-shaped structures under certain circumstances. Bacterial motility and the environment affect the eventual mushroom morphology. This study provides an agent-based model for the bacterial dynamics and interactions influencing bacterial biofilm shape. Cell motility in the model relies on recently published experimental data. Our simulations show colony formation by immotile cells. Motile cells escape from a single colony by nutrient chemotaxis and hence no mushroom shape develops. A high number density of non-motile colonies leads to migration of motile cells onto the top of the colonies and formation of mushroom-shaped structures. This model proposes that the formation of mushroom-shaped structures can be predicted by parameters at the time of bacteria inoculation. Depending on nutrient levels and the initial number density of stalks, mushroom-shaped structures only form in a restricted regime. This opens the possibility of early manipulation of spatial pattern formation in bacterial colonies, using environmental factors.