This is one of the trickiest aspects of learning how to use verbs in French, since English often lacks the clear distinction between the imperfect (in French expressed with verb forms with endings like '-ais'/'ait') and perfect ('avoir' plus the past participle, known as the passé composé). I have always imagined the difference between the two with the following analogy. Picture a stage. At the back is a colourful backdrop and some support cast miming. This is the information which should be conveyed in the imperfect: the scene is being set for the main drama later. If we were to describe what we see, this would be done in the imperfect: "Il faisait beau" ("The weather was nice"; "Des passants bavardaient" ("Some passersby were chatting"); "Le jardin était vert" ("The garden was green"). This should make clear the descriptive quality the imperfect often has, and also illustrates how these things are all ongoing and lack an obvious duration. Imagine now that the protagonist bursts onto the stage, screams, and drops dead. The perfect tense is used for precisely this, the main events, which will have a clear beginning and end. So: "Soudain, le voleur est entré" (Suddenly, the robber came in), "Il a crié, et puis est mort" (He shouted, and then died). If we put the two tenses together, the differences between the pair are clear: "Des passants bavardaient (imperfect: descriptive, ongoing, background info) quand le voleur est entré" (passé composé: sudden action, clear beginning and end). If you bear this distinction in mind, it will be a lot easier to pick the right tense when writing in the past in French.