Undoubtedly the most common approach to composing a bass line is to follow to root note of a chord. There's absolutely nothing wrong with that. Semiotically it makes great sense, and provides a whole lot of great aspects to a song - structure, harmonic reference, tone, power, and so on. That said, a bass line needn't always follow the root note of a chord progression.
This diagram for this lesson has been kept as simple as possible to highlight the principle involved. If you get it and want to expand on it then absolutely. That's the point of all our posts. You'll also notice this picture of a rather eclectic looking bass guitar, but this lesson is for any bass type instrument and how they can relate to a chord progression. Specifically we had a keyboard/piano player in mind when developing it.
If you are a keyboard player use the simple 1st, 3rd, 5th shapes for each chord. Also make sure you play each G chord exactly the same way. Easy, right. Good. Now to the bass line.
Each chord consists of two matching bass notes. If you take only the first note of each of those pairs you will get A - B - C - D. Match that to the chords am (A), G (B), F (C), G (D). Regardless of how the chords progress the bass line ascends in a scale sequence. Each of those notes (A, B, C, D) is a part of the triad of the chord it belongs to, it just doesn't always happen to be the root note. In fact, the a minor chord is the only chord where the bass plays the root note on the first beat of the chord it belongs to.
The other note of each pair is thrown in merely to add a little colour. You could simply play the first notes if you like, or play octaves to get a fuller sound. If you wanted to develop the idea of playing extra notes further try playing bass notes belonging to the scale of the chord that you are playing behind. That is, behind the a minor chord use an a minor scale, behind the G Major chord notes from the G Major scale and so on- but always maintain the initial note as part of the ascending sequence the whole bass line is built on.