As I noted in the previous post, the simple way to make your melody sound right is to emphasize notes that belong to the current chord.
The sophisticated way to make your melody sound interesting is to do the opposite: to emphasize notes that don't belong to the current chord. If you do this carelessly, you run the risk that the melody will just sound wrong. But there is a simple secret to doing things wrong and getting an artful result: craft the "wrong" element into a consistent, discernible pattern. Then it sounds like a deliberate choice instead of a mistake.
As you listen to other people's songs, and as you sing and play them, pay attention to which melody notes fit into the chords and which notes cut against the chords. Skilled songwriters use both kinds.