P-type conductors - doped to have more holes
N-type conductors - doped to have more electrons
At the depletion zone electrons from the N-type flow over to fill the holes in the P-type.
P-type thus becomes negatively charged at the depletion zone.
N-type thus becomes positively charged at the depletion zone.
NOW, the electrons in the negative P-type side of the PN junction want to move towards the positive. So, if you connect the P-type side to positive and the N-type side (full of empty holes at the depletion zone and hence positive) to the negative side of a power supply, the electrons happily go from the circuit into the N-type side while the electrons in the P-type side happily jump on out into the circuit leaving room in the depletion zone for those little electrons who have jumped into the N side (from the circuit) to mosey on over to the P side.
Hope that helps.
Now, the transister. What happens, if you have a current set to go up the NPN or PNP from Collector to Emitter (or the other way around, I always get confused with that - yes, I know I'm an electrical engineer but I blew up a few good transisters in my time
) the Base in between in preventing the flow of this current.
A little bit of current into the Base, however, reduces the Base area in between the Collector and Emitter and allows the current to flow through the transister.
So, you can see this is now acting as a SWITCH. But it is also acting as an AMPLIFIER because it only takes a small amount of current in to allow the larger amount of current to flow up through the tranasister.
Does that help?