Be sure to tune your instrument before attempting anything. For this, use a Electronic Tuner, an App or even a piano.
"Figuring out" a bass melody is quite similar to figuring out a vocal melody; you have to memorize the song and somehow imitate the sounds that you hear. For this, just explore the fretboard.
It is important to cover the general aspects first so you can get to the specifics later. Find out the "chords" first so you can progress to the "bassline" itself.
Listen to "Clocks" by Coldplay. You should hear the 3 main "chords". And throughout the song you will start detecting little variations of those chords. TRY. EXPLORE. IMITATE.