The first question you must ask yourself is whether your sentance contains a description of the scene or an action within the scene, For example, il neigeait (it was snowing) is descriptive and so it is written in the imperfect tense, where as the sentance il est tombé (he fell) shows an action that the character is doing and so it is written in the perfect tense.
When there is more than one verb in a sentance and both could be considered an action, it is important to remember that any continuous action which is interrupted by the second action is written in the imperfect while the new action is written in the perfect to show which is more current, For example, il dormait quand le téléphone a sonné (he was sleeping when the telephone rang).