Since drums can be tuned, yes they can technically play a melody but that's not often done. It can also be very involved/difficult to achieve, especially with a single drum. With instruments like woodblocks, however, it's easier to play more melodic parts, because each woodblock can have a different pitch. Drums are usually tuned to one, single pitch. So playing a melody on a single drum would require on-the-fly tuning while you play.