You can reach to hospet from mysore by bus and train if directly available. Then take bus to hampi from hospet which is just 45 min distance. But during summer visiting hampi is bad idea. Still You can make it if you wander in morning and sunset time only