Allthough the fun and Creativity comes at a price. Zombies and other hostile mobs spawn in the dark. They attack directly and claw at you until you collapse of pain, and die. To avoid this grueling nightmare, you have to beat him to the punch and Kill it. To do so, you need a weapon. A Sword will help you defeat it. Never try to kill a Zombie Barehanded, because THAT is suicidal. Even if you do kill it, another one will come and pick off what's left of your health. To combat the spawning of zombies, at least in the area of your house, is to place torches. Torches Make Mobs unable to spawn around them. It's a good idea to put torches around your house and inside. But Beware, it only stops them from spawning in the vicinity. It doesnt kill them. They will walk through the torches easily. If you have a good house, then you don't have to worry about zombies coming into your home.
For zombies, you can easily kill them with a sword. Never combat them bare-handed. You can't really sneak up on one.You can equip the sword in your hot-bar and hold down the mouse at the zombie to repeatedly swing the sword. Watch the duribility. Every hit is damage to your sword. Always be ready with a strong sword. If your sword is close to breaking, make a new one and have it handy. A Helmet or a pair of boots would help with the damage.