You need to protect your kingdom from invaders. Invaders move along a path. You need to build towers close to the path, so they'll shoot the enemies. Try to kill them all before they reach your castle. If you see that towers won't manage to kill all enemies and you have enough magic points, you can use one of the spells.